James McCool
commited on
Commit
·
69590e2
1
Parent(s):
679a52f
Refactor date handling in grab_contest_names function for improved formatting
Browse files- Updated the date parsing in the grab_contest_names function to remove the explicit format specification, allowing for more flexible date handling.
- Reformatted the 'Date' column to ensure consistent output as '%Y-%m-%d', enhancing data presentation and usability.
- This change supports ongoing efforts to improve data processing and maintain data integrity within the application.
app.py
CHANGED
@@ -22,7 +22,8 @@ def grab_contest_names(db, sport):
|
|
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']))
|
|
|
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 |
+
curr_info['Date'] = curr_info['Date'].dt.strftime('%Y-%m-%d')
|
27 |
contest_names = curr_info['Contest Name']
|
28 |
contest_id_map = dict(zip(curr_info['Contest Name'], curr_info['Contest ID']))
|
29 |
contest_date_map = dict(zip(curr_info['Contest Name'], curr_info['Date']))
|