James McCool
commited on
Commit
·
38d3f0b
1
Parent(s):
e3e4a8e
Add date parsing to contest data in app.py for improved data handling
Browse files- Introduced datetime parsing for the 'Date' column in the grab_contest_names function, enhancing data accessibility and usability.
- This change supports ongoing efforts to streamline data processing and improve overall application functionality.
app.py
CHANGED
@@ -7,6 +7,7 @@ from fuzzywuzzy import process
|
|
7 |
from collections import Counter
|
8 |
from pymongo.mongo_client import MongoClient
|
9 |
from pymongo.server_api import ServerApi
|
|
|
10 |
|
11 |
def init_conn():
|
12 |
|
@@ -21,9 +22,11 @@ def grab_contest_names(db, sport):
|
|
21 |
cursor = collection.find()
|
22 |
|
23 |
curr_info = pd.DataFrame(list(cursor)).drop('_id', axis=1)
|
|
|
24 |
contest_names = curr_info['Contest Name']
|
25 |
contest_id_map = dict(zip(curr_info['Contest Name'], curr_info['Contest ID']))
|
26 |
contest_date_map = dict(zip(curr_info['Contest Name'], curr_info['Date']))
|
|
|
27 |
|
28 |
return contest_names, contest_id_map, contest_date_map, curr_info
|
29 |
|
|
|
7 |
from collections import Counter
|
8 |
from pymongo.mongo_client import MongoClient
|
9 |
from pymongo.server_api import ServerApi
|
10 |
+
from datetime import datetime
|
11 |
|
12 |
def init_conn():
|
13 |
|
|
|
22 |
cursor = collection.find()
|
23 |
|
24 |
curr_info = pd.DataFrame(list(cursor)).drop('_id', axis=1)
|
25 |
+
curr_info['Date'] = pd.to_datetime(curr_info['Date'])
|
26 |
contest_names = curr_info['Contest Name']
|
27 |
contest_id_map = dict(zip(curr_info['Contest Name'], curr_info['Contest ID']))
|
28 |
contest_date_map = dict(zip(curr_info['Contest Name'], curr_info['Date']))
|
29 |
+
|
30 |
|
31 |
return contest_names, contest_id_map, contest_date_map, curr_info
|
32 |
|