Spaces:
Sleeping
Sleeping
James McCool
commited on
Commit
·
4723d1e
1
Parent(s):
12a3239
Refactor data export logic in app.py: remove index settings for player position columns in Draftkings and Fanduel exports, simplifying the export process while ensuring accurate data representation for NBA and WNBA leagues.
Browse files
app.py
CHANGED
|
@@ -646,7 +646,6 @@ with tab2:
|
|
| 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':
|
|
@@ -657,13 +656,10 @@ with tab2:
|
|
| 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(
|
|
@@ -676,19 +672,23 @@ with tab2:
|
|
| 676 |
if site_var2 == 'Draftkings':
|
| 677 |
if slate_type_var1 == 'Regular':
|
| 678 |
if league_var == 'NBA':
|
| 679 |
-
|
| 680 |
elif league_var == 'WNBA':
|
| 681 |
-
|
| 682 |
elif slate_type_var1 == 'Showdown':
|
| 683 |
-
|
|
|
|
|
|
|
| 684 |
elif site_var2 == 'Fanduel':
|
| 685 |
if slate_type_var1 == 'Regular':
|
| 686 |
if league_var == 'NBA':
|
| 687 |
-
|
| 688 |
elif league_var == 'WNBA':
|
| 689 |
-
|
| 690 |
elif slate_type_var1 == 'Showdown':
|
| 691 |
-
|
|
|
|
|
|
|
| 692 |
st.download_button(
|
| 693 |
label="Portfolio Manager Export (Names)",
|
| 694 |
data=convert_pm_df(name_export),
|
|
@@ -749,19 +749,19 @@ with tab2:
|
|
| 749 |
if site_var2 == 'Draftkings':
|
| 750 |
if slate_type_var1 == 'Regular':
|
| 751 |
if league_var == 'NBA':
|
| 752 |
-
data_export = data_export.
|
| 753 |
elif league_var == 'WNBA':
|
| 754 |
-
data_export = data_export.
|
| 755 |
elif slate_type_var1 == 'Showdown':
|
| 756 |
-
data_export = data_export.
|
| 757 |
elif site_var2 == 'Fanduel':
|
| 758 |
if slate_type_var1 == 'Regular':
|
| 759 |
if league_var == 'NBA':
|
| 760 |
-
data_export = data_export.
|
| 761 |
elif league_var == 'WNBA':
|
| 762 |
-
data_export = data_export.
|
| 763 |
elif slate_type_var1 == 'Showdown':
|
| 764 |
-
data_export = data_export.
|
| 765 |
st.download_button(
|
| 766 |
label="Portfolio Manager Export (IDs)",
|
| 767 |
data=convert_pm_df(data_export),
|
|
@@ -772,19 +772,19 @@ with tab2:
|
|
| 772 |
if site_var2 == 'Draftkings':
|
| 773 |
if slate_type_var1 == 'Regular':
|
| 774 |
if league_var == 'NBA':
|
| 775 |
-
name_export = name_export.
|
| 776 |
elif league_var == 'WNBA':
|
| 777 |
-
name_export = name_export.
|
| 778 |
elif slate_type_var1 == 'Showdown':
|
| 779 |
-
name_export = name_export.
|
| 780 |
elif site_var2 == 'Fanduel':
|
| 781 |
if slate_type_var1 == 'Regular':
|
| 782 |
if league_var == 'NBA':
|
| 783 |
-
name_export = name_export.
|
| 784 |
elif league_var == 'WNBA':
|
| 785 |
-
name_export = name_export.
|
| 786 |
elif slate_type_var1 == 'Showdown':
|
| 787 |
-
name_export = name_export.
|
| 788 |
st.download_button(
|
| 789 |
label="Portfolio Manager Export (Names)",
|
| 790 |
data=convert_pm_df(name_export),
|
|
|
|
| 646 |
if slate_type_var1 == 'Regular':
|
| 647 |
if league_var == 'NBA':
|
| 648 |
map_columns = ['PG', 'SG', 'SF', 'PF', 'C', 'G', 'F', 'FLEX']
|
|
|
|
| 649 |
elif league_var == 'WNBA':
|
| 650 |
map_columns = ['G1', 'G2', 'F1', 'F2', 'F3', 'UTIL']
|
| 651 |
elif slate_type_var1 == 'Showdown':
|
|
|
|
| 656 |
if slate_type_var1 == 'Regular':
|
| 657 |
if league_var == 'NBA':
|
| 658 |
map_columns = ['PG1', 'PG2', 'SG1', 'SG2', 'SF1', 'SF2', 'PF1', 'PF2', 'C1', 'C2', 'UTIL']
|
|
|
|
| 659 |
elif league_var == 'WNBA':
|
| 660 |
map_columns = ['G1', 'G2', 'G3', 'F1', 'F2', 'F3', 'F4']
|
|
|
|
| 661 |
elif slate_type_var1 == 'Showdown':
|
| 662 |
map_columns = ['CPT', 'FLEX1', 'FLEX2', 'FLEX3', 'FLEX4']
|
|
|
|
| 663 |
for col_idx in map_columns:
|
| 664 |
data_export[col_idx] = data_export[col_idx].map(id_dict)
|
| 665 |
st.download_button(
|
|
|
|
| 672 |
if site_var2 == 'Draftkings':
|
| 673 |
if slate_type_var1 == 'Regular':
|
| 674 |
if league_var == 'NBA':
|
| 675 |
+
map_columns = ['PG', 'SG', 'SF', 'PF', 'C', 'G', 'F', 'FLEX']
|
| 676 |
elif league_var == 'WNBA':
|
| 677 |
+
map_columns = ['G1', 'G2', 'F1', 'F2', 'F3', 'UTIL']
|
| 678 |
elif slate_type_var1 == 'Showdown':
|
| 679 |
+
map_columns = ['CPT', 'FLEX1', 'FLEX2', 'FLEX3', 'FLEX4', 'FLEX5']
|
| 680 |
+
for col_idx in map_columns:
|
| 681 |
+
name_export[col_idx] = name_export[col_idx].map(id_dict)
|
| 682 |
elif site_var2 == 'Fanduel':
|
| 683 |
if slate_type_var1 == 'Regular':
|
| 684 |
if league_var == 'NBA':
|
| 685 |
+
map_columns = ['PG1', 'PG2', 'SG1', 'SG2', 'SF1', 'SF2', 'PF1', 'PF2', 'C1', 'C2', 'UTIL']
|
| 686 |
elif league_var == 'WNBA':
|
| 687 |
+
map_columns = ['G1', 'G2', 'G3', 'F1', 'F2', 'F3', 'F4']
|
| 688 |
elif slate_type_var1 == 'Showdown':
|
| 689 |
+
map_columns = ['CPT', 'FLEX1', 'FLEX2', 'FLEX3', 'FLEX4']
|
| 690 |
+
for col_idx in map_columns:
|
| 691 |
+
name_export[col_idx] = name_export[col_idx].map(id_dict)
|
| 692 |
st.download_button(
|
| 693 |
label="Portfolio Manager Export (Names)",
|
| 694 |
data=convert_pm_df(name_export),
|
|
|
|
| 749 |
if site_var2 == 'Draftkings':
|
| 750 |
if slate_type_var1 == 'Regular':
|
| 751 |
if league_var == 'NBA':
|
| 752 |
+
data_export = data_export.drop(columns=['salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own'], axis=1)
|
| 753 |
elif league_var == 'WNBA':
|
| 754 |
+
data_export = data_export.drop(columns=['salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own'], axis=1)
|
| 755 |
elif slate_type_var1 == 'Showdown':
|
| 756 |
+
data_export = data_export.drop(columns=['salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own'], axis=1)
|
| 757 |
elif site_var2 == 'Fanduel':
|
| 758 |
if slate_type_var1 == 'Regular':
|
| 759 |
if league_var == 'NBA':
|
| 760 |
+
data_export = data_export.drop(columns=['salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own'], axis=1)
|
| 761 |
elif league_var == 'WNBA':
|
| 762 |
+
data_export = data_export.drop(columns=['salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own'], axis=1)
|
| 763 |
elif slate_type_var1 == 'Showdown':
|
| 764 |
+
data_export = data_export.drop(columns=['salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own'], axis=1)
|
| 765 |
st.download_button(
|
| 766 |
label="Portfolio Manager Export (IDs)",
|
| 767 |
data=convert_pm_df(data_export),
|
|
|
|
| 772 |
if site_var2 == 'Draftkings':
|
| 773 |
if slate_type_var1 == 'Regular':
|
| 774 |
if league_var == 'NBA':
|
| 775 |
+
name_export = name_export.drop(columns=['salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own'], axis=1)
|
| 776 |
elif league_var == 'WNBA':
|
| 777 |
+
name_export = name_export.drop(columns=['salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own'], axis=1)
|
| 778 |
elif slate_type_var1 == 'Showdown':
|
| 779 |
+
name_export = name_export.drop(columns=['salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own'], axis=1)
|
| 780 |
elif site_var2 == 'Fanduel':
|
| 781 |
if slate_type_var1 == 'Regular':
|
| 782 |
if league_var == 'NBA':
|
| 783 |
+
name_export = name_export.drop(columns=['salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own'], axis=1)
|
| 784 |
elif league_var == 'WNBA':
|
| 785 |
+
name_export = name_export.drop(columns=['salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own'], axis=1)
|
| 786 |
elif slate_type_var1 == 'Showdown':
|
| 787 |
+
name_export = name_export.drop(columns=['salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own'], axis=1)
|
| 788 |
st.download_button(
|
| 789 |
label="Portfolio Manager Export (Names)",
|
| 790 |
data=convert_pm_df(name_export),
|