Spaces:
Running
Running
James McCool
commited on
Commit
·
12a3239
1
Parent(s):
a65bd9a
Enhance data export logic in app.py: introduce mapping for player position columns in Draftkings and Fanduel exports, ensuring accurate data representation for NBA and WNBA leagues. This update improves the handling of player data during export processes.
Browse files
app.py
CHANGED
@@ -645,19 +645,27 @@ with tab2:
|
|
645 |
if site_var2 == 'Draftkings':
|
646 |
if slate_type_var1 == 'Regular':
|
647 |
if league_var == 'NBA':
|
|
|
648 |
data_export = data_export.set_index('PG').drop(columns=['salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own'], axis=1)
|
649 |
elif league_var == 'WNBA':
|
650 |
-
|
651 |
elif slate_type_var1 == 'Showdown':
|
652 |
-
|
|
|
|
|
653 |
elif site_var2 == 'Fanduel':
|
654 |
if slate_type_var1 == 'Regular':
|
655 |
if league_var == 'NBA':
|
|
|
656 |
data_export = data_export.set_index('PG1').drop(columns=['salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own'], axis=1)
|
657 |
elif league_var == 'WNBA':
|
|
|
658 |
data_export = data_export.drop(columns=['salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own'], axis=1)
|
659 |
elif slate_type_var1 == 'Showdown':
|
|
|
660 |
data_export = data_export.set_index('CPT').drop(columns=['salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own'], axis=1)
|
|
|
|
|
661 |
st.download_button(
|
662 |
label="Portfolio Manager Export (IDs)",
|
663 |
data=convert_pm_df(data_export),
|
|
|
645 |
if site_var2 == 'Draftkings':
|
646 |
if slate_type_var1 == 'Regular':
|
647 |
if league_var == 'NBA':
|
648 |
+
map_columns = ['PG', 'SG', 'SF', 'PF', 'C', 'G', 'F', 'FLEX']
|
649 |
data_export = data_export.set_index('PG').drop(columns=['salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own'], axis=1)
|
650 |
elif league_var == 'WNBA':
|
651 |
+
map_columns = ['G1', 'G2', 'F1', 'F2', 'F3', 'UTIL']
|
652 |
elif slate_type_var1 == 'Showdown':
|
653 |
+
map_columns = ['CPT', 'FLEX1', 'FLEX2', 'FLEX3', 'FLEX4', 'FLEX5']
|
654 |
+
for col_idx in map_columns:
|
655 |
+
data_export[col_idx] = data_export[col_idx].map(id_dict)
|
656 |
elif site_var2 == 'Fanduel':
|
657 |
if slate_type_var1 == 'Regular':
|
658 |
if league_var == 'NBA':
|
659 |
+
map_columns = ['PG1', 'PG2', 'SG1', 'SG2', 'SF1', 'SF2', 'PF1', 'PF2', 'C1', 'C2', 'UTIL']
|
660 |
data_export = data_export.set_index('PG1').drop(columns=['salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own'], axis=1)
|
661 |
elif league_var == 'WNBA':
|
662 |
+
map_columns = ['G1', 'G2', 'G3', 'F1', 'F2', 'F3', 'F4']
|
663 |
data_export = data_export.drop(columns=['salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own'], axis=1)
|
664 |
elif slate_type_var1 == 'Showdown':
|
665 |
+
map_columns = ['CPT', 'FLEX1', 'FLEX2', 'FLEX3', 'FLEX4']
|
666 |
data_export = data_export.set_index('CPT').drop(columns=['salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own'], axis=1)
|
667 |
+
for col_idx in map_columns:
|
668 |
+
data_export[col_idx] = data_export[col_idx].map(id_dict)
|
669 |
st.download_button(
|
670 |
label="Portfolio Manager Export (IDs)",
|
671 |
data=convert_pm_df(data_export),
|