Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -753,7 +753,7 @@ with tab2:
|
|
| 753 |
scaling_var = 15
|
| 754 |
|
| 755 |
with col2:
|
| 756 |
-
with st.
|
| 757 |
if st.button("Simulate Contest", key='sim1'):
|
| 758 |
try:
|
| 759 |
del dst_freq
|
|
@@ -1055,7 +1055,7 @@ with tab2:
|
|
| 1055 |
for checkVar in range(len(team_list)):
|
| 1056 |
player_freq['Team'] = player_freq['Team'].replace(item_list, team_list)
|
| 1057 |
|
| 1058 |
-
player_freq = player_freq[['Player', 'Position', 'Team', 'Salary', 'Proj Own', 'Exposure', 'Edge']]
|
| 1059 |
|
| 1060 |
cpt_freq = pd.DataFrame(np.column_stack(np.unique(st.session_state.Sim_Winner_Frame.iloc[:,0:1].values, return_counts=True)),
|
| 1061 |
columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
|
|
@@ -1069,7 +1069,7 @@ with tab2:
|
|
| 1069 |
for checkVar in range(len(team_list)):
|
| 1070 |
cpt_freq['Team'] = cpt_freq['Team'].replace(item_list, team_list)
|
| 1071 |
|
| 1072 |
-
cpt_freq = cpt_freq[['Player', 'Position', 'Team', 'Salary', 'Proj Own', 'Exposure', 'Edge']]
|
| 1073 |
|
| 1074 |
flex_freq = pd.DataFrame(np.column_stack(np.unique(st.session_state.Sim_Winner_Frame.iloc[:,[1, 2, 3, 4, 5]].values, return_counts=True)),
|
| 1075 |
columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
|
|
@@ -1083,7 +1083,7 @@ with tab2:
|
|
| 1083 |
for checkVar in range(len(team_list)):
|
| 1084 |
flex_freq['Team'] = flex_freq['Team'].replace(item_list, team_list)
|
| 1085 |
|
| 1086 |
-
flex_freq = flex_freq[['Player', 'Position', 'Team', 'Salary', 'Proj Own', 'Exposure', 'Edge']]
|
| 1087 |
|
| 1088 |
del fp_random
|
| 1089 |
del sample_arrays
|
|
@@ -1127,26 +1127,29 @@ with tab2:
|
|
| 1127 |
with st.container():
|
| 1128 |
tab1, tab2, tab3 = st.tabs(['Overall Exposures', 'CPT Exposures', 'FLEX Exposures'])
|
| 1129 |
with tab1:
|
| 1130 |
-
|
| 1131 |
-
|
| 1132 |
-
|
| 1133 |
-
|
| 1134 |
-
|
| 1135 |
-
|
| 1136 |
-
|
|
|
|
| 1137 |
with tab2:
|
| 1138 |
-
|
| 1139 |
-
|
| 1140 |
-
|
| 1141 |
-
|
| 1142 |
-
|
| 1143 |
-
|
| 1144 |
-
|
|
|
|
| 1145 |
with tab3:
|
| 1146 |
-
|
| 1147 |
-
|
| 1148 |
-
|
| 1149 |
-
|
| 1150 |
-
|
| 1151 |
-
|
| 1152 |
-
|
|
|
|
|
|
| 753 |
scaling_var = 15
|
| 754 |
|
| 755 |
with col2:
|
| 756 |
+
with st.conatainer():
|
| 757 |
if st.button("Simulate Contest", key='sim1'):
|
| 758 |
try:
|
| 759 |
del dst_freq
|
|
|
|
| 1055 |
for checkVar in range(len(team_list)):
|
| 1056 |
player_freq['Team'] = player_freq['Team'].replace(item_list, team_list)
|
| 1057 |
|
| 1058 |
+
st.session_state.player_freq = player_freq[['Player', 'Position', 'Team', 'Salary', 'Proj Own', 'Exposure', 'Edge']]
|
| 1059 |
|
| 1060 |
cpt_freq = pd.DataFrame(np.column_stack(np.unique(st.session_state.Sim_Winner_Frame.iloc[:,0:1].values, return_counts=True)),
|
| 1061 |
columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
|
|
|
|
| 1069 |
for checkVar in range(len(team_list)):
|
| 1070 |
cpt_freq['Team'] = cpt_freq['Team'].replace(item_list, team_list)
|
| 1071 |
|
| 1072 |
+
st.session_state.cpt_freq = cpt_freq[['Player', 'Position', 'Team', 'Salary', 'Proj Own', 'Exposure', 'Edge']]
|
| 1073 |
|
| 1074 |
flex_freq = pd.DataFrame(np.column_stack(np.unique(st.session_state.Sim_Winner_Frame.iloc[:,[1, 2, 3, 4, 5]].values, return_counts=True)),
|
| 1075 |
columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
|
|
|
|
| 1083 |
for checkVar in range(len(team_list)):
|
| 1084 |
flex_freq['Team'] = flex_freq['Team'].replace(item_list, team_list)
|
| 1085 |
|
| 1086 |
+
st.session_state.flex_freq = flex_freq[['Player', 'Position', 'Team', 'Salary', 'Proj Own', 'Exposure', 'Edge']]
|
| 1087 |
|
| 1088 |
del fp_random
|
| 1089 |
del sample_arrays
|
|
|
|
| 1127 |
with st.container():
|
| 1128 |
tab1, tab2, tab3 = st.tabs(['Overall Exposures', 'CPT Exposures', 'FLEX Exposures'])
|
| 1129 |
with tab1:
|
| 1130 |
+
if 'player_freq' in st.session_state:
|
| 1131 |
+
st.dataframe(st.session_state.player_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(freq_format, precision=2), use_container_width = True)
|
| 1132 |
+
st.download_button(
|
| 1133 |
+
label="Export Exposures",
|
| 1134 |
+
data=convert_df_to_csv(st.session_state.player_freq),
|
| 1135 |
+
file_name='player_freq_export.csv',
|
| 1136 |
+
mime='text/csv',
|
| 1137 |
+
)
|
| 1138 |
with tab2:
|
| 1139 |
+
if 'player_freq' in st.session_state:
|
| 1140 |
+
st.dataframe(st.session_state.cpt_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(freq_format, precision=2), use_container_width = True)
|
| 1141 |
+
st.download_button(
|
| 1142 |
+
label="Export Exposures",
|
| 1143 |
+
data=convert_df_to_csv(st.session_state.cpt_freq),
|
| 1144 |
+
file_name='cpt_freq_export.csv',
|
| 1145 |
+
mime='text/csv',
|
| 1146 |
+
)
|
| 1147 |
with tab3:
|
| 1148 |
+
if 'player_freq' in st.session_state:
|
| 1149 |
+
st.dataframe(st.session_state.flex_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(freq_format, precision=2), use_container_width = True)
|
| 1150 |
+
st.download_button(
|
| 1151 |
+
label="Export Exposures",
|
| 1152 |
+
data=convert_df_to_csv(st.session_state.flex_freq),
|
| 1153 |
+
file_name='flex_freq_export.csv',
|
| 1154 |
+
mime='text/csv',
|
| 1155 |
+
)
|