Update app.py
Browse files
app.py
CHANGED
@@ -720,6 +720,10 @@ with tab2:
|
|
720 |
raw_baselines = dk_roo_raw
|
721 |
elif slate_var1 == 'Paydirt (Secondary)':
|
722 |
raw_baselines = dk_roo_raw_2
|
|
|
|
|
|
|
|
|
723 |
st.info("If you are uploading a portfolio, note that there is an adjustments to projections and deviation mapping to prevent 'Projection Bias' and create a fair simulation")
|
724 |
insert_port1 = st.selectbox("Are you uploading a portfolio?", ('No', 'Yes'))
|
725 |
if insert_port1 == 'Yes':
|
@@ -1030,9 +1034,12 @@ with tab2:
|
|
1030 |
Sim_Winner_Frame['Projection'] = Sim_Winner_Frame['Projection'].astype(np.float16)
|
1031 |
Sim_Winner_Frame['Fantasy'] = Sim_Winner_Frame['Fantasy'].astype(np.float16)
|
1032 |
Sim_Winner_Frame['GPP_Proj'] = Sim_Winner_Frame['GPP_Proj'].astype(np.float16)
|
1033 |
-
Sim_Winner_Frame = Sim_Winner_Frame.sort_values(by='GPP_Proj', ascending=False)
|
|
|
1034 |
|
1035 |
-
|
|
|
|
|
1036 |
columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
|
1037 |
player_freq['Freq'] = player_freq['Freq'].astype(int)
|
1038 |
player_freq['Position'] = player_freq['Player'].map(maps_dict['Pos_map'])
|
@@ -1046,7 +1053,7 @@ with tab2:
|
|
1046 |
|
1047 |
player_freq = player_freq[['Player', 'Position', 'Team', 'Salary', 'Proj Own', 'Exposure', 'Edge']]
|
1048 |
|
1049 |
-
cpt_freq = pd.DataFrame(np.column_stack(np.unique(Sim_Winner_Frame.iloc[:,0:1].values, return_counts=True)),
|
1050 |
columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
|
1051 |
cpt_freq['Freq'] = cpt_freq['Freq'].astype(int)
|
1052 |
cpt_freq['Position'] = cpt_freq['Player'].map(maps_dict['Pos_map'])
|
@@ -1060,7 +1067,7 @@ with tab2:
|
|
1060 |
|
1061 |
cpt_freq = cpt_freq[['Player', 'Position', 'Team', 'Salary', 'Proj Own', 'Exposure', 'Edge']]
|
1062 |
|
1063 |
-
flex_freq = pd.DataFrame(np.column_stack(np.unique(Sim_Winner_Frame.iloc[:,[1, 2, 3, 4, 5]].values, return_counts=True)),
|
1064 |
columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
|
1065 |
flex_freq['Freq'] = flex_freq['Freq'].astype(int)
|
1066 |
flex_freq['Position'] = flex_freq['Player'].map(maps_dict['Pos_map'])
|
@@ -1091,7 +1098,7 @@ with tab2:
|
|
1091 |
del Sim_size
|
1092 |
|
1093 |
with st.container():
|
1094 |
-
st.dataframe(Sim_Winner_Frame.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').background_gradient(cmap='RdYlGn_r', subset=['Own']).format(precision=2), use_container_width = True)
|
1095 |
|
1096 |
with st.container():
|
1097 |
tab1, tab2, tab3 = st.tabs(['Overall Exposures', 'CPT Exposures', 'FLEX Exposures'])
|
@@ -1122,7 +1129,7 @@ with tab2:
|
|
1122 |
|
1123 |
st.download_button(
|
1124 |
label="Export Tables",
|
1125 |
-
data=convert_df_to_csv(
|
1126 |
file_name='NFL_consim_export.csv',
|
1127 |
mime='text/csv',
|
1128 |
-
)
|
|
|
720 |
raw_baselines = dk_roo_raw
|
721 |
elif slate_var1 == 'Paydirt (Secondary)':
|
722 |
raw_baselines = dk_roo_raw_2
|
723 |
+
del dk_roo_raw
|
724 |
+
del dk_roo_raw_2
|
725 |
+
del fd_roo_raw
|
726 |
+
del fd_roo_raw_2
|
727 |
st.info("If you are uploading a portfolio, note that there is an adjustments to projections and deviation mapping to prevent 'Projection Bias' and create a fair simulation")
|
728 |
insert_port1 = st.selectbox("Are you uploading a portfolio?", ('No', 'Yes'))
|
729 |
if insert_port1 == 'Yes':
|
|
|
1034 |
Sim_Winner_Frame['Projection'] = Sim_Winner_Frame['Projection'].astype(np.float16)
|
1035 |
Sim_Winner_Frame['Fantasy'] = Sim_Winner_Frame['Fantasy'].astype(np.float16)
|
1036 |
Sim_Winner_Frame['GPP_Proj'] = Sim_Winner_Frame['GPP_Proj'].astype(np.float16)
|
1037 |
+
st.session_state.Sim_Winner_Frame = Sim_Winner_Frame.sort_values(by='GPP_Proj', ascending=False)
|
1038 |
+
st.session_state.Sim_Winner_Export = Sim_Winner_Frame.copy()
|
1039 |
|
1040 |
+
del Sim_Winner_Frame
|
1041 |
+
|
1042 |
+
player_freq = pd.DataFrame(np.column_stack(np.unique(st.session_state.Sim_Winner_Frame.iloc[:,0:6].values, return_counts=True)),
|
1043 |
columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
|
1044 |
player_freq['Freq'] = player_freq['Freq'].astype(int)
|
1045 |
player_freq['Position'] = player_freq['Player'].map(maps_dict['Pos_map'])
|
|
|
1053 |
|
1054 |
player_freq = player_freq[['Player', 'Position', 'Team', 'Salary', 'Proj Own', 'Exposure', 'Edge']]
|
1055 |
|
1056 |
+
cpt_freq = pd.DataFrame(np.column_stack(np.unique(st.session_state.Sim_Winner_Frame.iloc[:,0:1].values, return_counts=True)),
|
1057 |
columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
|
1058 |
cpt_freq['Freq'] = cpt_freq['Freq'].astype(int)
|
1059 |
cpt_freq['Position'] = cpt_freq['Player'].map(maps_dict['Pos_map'])
|
|
|
1067 |
|
1068 |
cpt_freq = cpt_freq[['Player', 'Position', 'Team', 'Salary', 'Proj Own', 'Exposure', 'Edge']]
|
1069 |
|
1070 |
+
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)),
|
1071 |
columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
|
1072 |
flex_freq['Freq'] = flex_freq['Freq'].astype(int)
|
1073 |
flex_freq['Position'] = flex_freq['Player'].map(maps_dict['Pos_map'])
|
|
|
1098 |
del Sim_size
|
1099 |
|
1100 |
with st.container():
|
1101 |
+
st.dataframe(st.session_state.Sim_Winner_Frame.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').background_gradient(cmap='RdYlGn_r', subset=['Own']).format(precision=2), use_container_width = True)
|
1102 |
|
1103 |
with st.container():
|
1104 |
tab1, tab2, tab3 = st.tabs(['Overall Exposures', 'CPT Exposures', 'FLEX Exposures'])
|
|
|
1129 |
|
1130 |
st.download_button(
|
1131 |
label="Export Tables",
|
1132 |
+
data=convert_df_to_csv(st.session_state.Sim_Winner_Frame_export),
|
1133 |
file_name='NFL_consim_export.csv',
|
1134 |
mime='text/csv',
|
1135 |
+
)
|