James McCool
commited on
Commit
·
ab18789
1
Parent(s):
1bf8256
Refactor grab_contest_data function to return DataFrame instead of CSV
Browse files- Updated the grab_contest_data function to return the merged DataFrame directly, allowing for more flexible data handling.
- Enhanced load_contest_file function to support loading DataFrames directly, improving usability for users who may work with DataFrames in their workflow.
global_func/grab_contest_data.py
CHANGED
@@ -69,4 +69,4 @@ def grab_contest_data(sport, contest_name, contest_id_map, contest_date_map):
|
|
69 |
|
70 |
total_data = lineups_df.merge(players_df, how='left', left_index=True, right_index=True)
|
71 |
|
72 |
-
return total_data
|
|
|
69 |
|
70 |
total_data = lineups_df.merge(players_df, how='left', left_index=True, right_index=True)
|
71 |
|
72 |
+
return total_data
|
global_func/load_contest_file.py
CHANGED
@@ -9,6 +9,8 @@ def load_contest_file(upload, sport):
|
|
9 |
raw_df = pd.read_csv(upload)
|
10 |
elif upload.name.endswith(('.xls', '.xlsx')):
|
11 |
raw_df = pd.read_excel(upload)
|
|
|
|
|
12 |
else:
|
13 |
st.error('Please upload either a CSV or Excel file')
|
14 |
return None
|
|
|
9 |
raw_df = pd.read_csv(upload)
|
10 |
elif upload.name.endswith(('.xls', '.xlsx')):
|
11 |
raw_df = pd.read_excel(upload)
|
12 |
+
elif isinstance(upload, pd.DataFrame):
|
13 |
+
raw_df = upload
|
14 |
else:
|
15 |
st.error('Please upload either a CSV or Excel file')
|
16 |
return None
|