Spaces:
Running
Running
James McCool
commited on
Commit
·
29e7d2d
1
Parent(s):
16a2718
Enhance data export functionality in app.py: add separate download buttons for optimal lineups by player names and IDs, improving user experience and data accessibility.
Browse files
app.py
CHANGED
@@ -424,29 +424,38 @@ with tab2:
|
|
424 |
if site_var1 == 'Draftkings':
|
425 |
if slate_type_var1 == 'Regular':
|
426 |
data_export = init_DK_lineups(slate_var1)
|
|
|
427 |
for col_idx in range(8):
|
428 |
data_export[:, col_idx] = np.array([id_dict.get(player, player) for player in data_export[:, col_idx]])
|
429 |
elif slate_type_var1 == 'Showdown':
|
430 |
data_export = init_DK_SD_lineups(slate_var1)
|
|
|
431 |
for col_idx in range(6):
|
432 |
data_export[:, col_idx] = np.array([id_dict_sd.get(player, player) for player in data_export[:, col_idx]])
|
433 |
|
434 |
elif site_var1 == 'Fanduel':
|
435 |
if slate_type_var1 == 'Regular':
|
436 |
data_export = init_FD_lineups(slate_var1)
|
|
|
437 |
for col_idx in range(9):
|
438 |
data_export[:, col_idx] = np.array([id_dict.get(player, player) for player in data_export[:, col_idx]])
|
439 |
elif slate_type_var1 == 'Showdown':
|
440 |
data_export = init_FD_SD_lineups(slate_var1)
|
|
|
441 |
for col_idx in range(6):
|
442 |
data_export[:, col_idx] = np.array([id_dict_sd.get(player, player) for player in data_export[:, col_idx]])
|
443 |
-
|
444 |
st.download_button(
|
445 |
-
label="Export optimals
|
|
|
|
|
|
|
|
|
|
|
|
|
446 |
data=convert_df(data_export),
|
447 |
file_name='NBA_optimals_export.csv',
|
448 |
mime='text/csv',
|
449 |
-
|
450 |
|
451 |
|
452 |
if site_var1 == 'Draftkings':
|
|
|
424 |
if site_var1 == 'Draftkings':
|
425 |
if slate_type_var1 == 'Regular':
|
426 |
data_export = init_DK_lineups(slate_var1)
|
427 |
+
data_export_names = data_export.copy()
|
428 |
for col_idx in range(8):
|
429 |
data_export[:, col_idx] = np.array([id_dict.get(player, player) for player in data_export[:, col_idx]])
|
430 |
elif slate_type_var1 == 'Showdown':
|
431 |
data_export = init_DK_SD_lineups(slate_var1)
|
432 |
+
data_export_names = data_export.copy()
|
433 |
for col_idx in range(6):
|
434 |
data_export[:, col_idx] = np.array([id_dict_sd.get(player, player) for player in data_export[:, col_idx]])
|
435 |
|
436 |
elif site_var1 == 'Fanduel':
|
437 |
if slate_type_var1 == 'Regular':
|
438 |
data_export = init_FD_lineups(slate_var1)
|
439 |
+
data_export_names = data_export.copy()
|
440 |
for col_idx in range(9):
|
441 |
data_export[:, col_idx] = np.array([id_dict.get(player, player) for player in data_export[:, col_idx]])
|
442 |
elif slate_type_var1 == 'Showdown':
|
443 |
data_export = init_FD_SD_lineups(slate_var1)
|
444 |
+
data_export_names = data_export.copy()
|
445 |
for col_idx in range(6):
|
446 |
data_export[:, col_idx] = np.array([id_dict_sd.get(player, player) for player in data_export[:, col_idx]])
|
|
|
447 |
st.download_button(
|
448 |
+
label="Export optimals (Names)",
|
449 |
+
data=convert_df(data_export_names),
|
450 |
+
file_name='NBA_optimals_export.csv',
|
451 |
+
mime='text/csv',
|
452 |
+
)
|
453 |
+
st.download_button(
|
454 |
+
label="Export optimals (IDs)",
|
455 |
data=convert_df(data_export),
|
456 |
file_name='NBA_optimals_export.csv',
|
457 |
mime='text/csv',
|
458 |
+
)
|
459 |
|
460 |
|
461 |
if site_var1 == 'Draftkings':
|