Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -919,88 +919,87 @@ with tab2:
|
|
919 |
dst_freq = pd.DataFrame()
|
920 |
|
921 |
with col2:
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
938 |
st.download_button(
|
939 |
-
label="Export
|
940 |
-
data=convert_df_to_csv(
|
941 |
-
file_name='
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
942 |
mime='text/csv',
|
943 |
)
|
944 |
-
|
945 |
-
with st.container():
|
946 |
-
freq_container = st.empty()
|
947 |
-
tab1, tab2, tab3, tab4, tab5, tab6, tab7 = st.tabs(['Overall Exposures', 'QB Exposures', 'RB Exposures', 'WR Exposures', 'TE Exposures', 'FLEX Exposures', 'DST Exposures'])
|
948 |
-
with tab1:
|
949 |
-
st.dataframe(player_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(freq_format, precision=2), use_container_width = True)
|
950 |
-
st.download_button(
|
951 |
-
label="Export Exposures",
|
952 |
-
data=convert_df_to_csv(player_freq),
|
953 |
-
file_name='player_freq_export.csv',
|
954 |
-
mime='text/csv',
|
955 |
-
)
|
956 |
-
with tab2:
|
957 |
-
st.dataframe(qb_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(freq_format, precision=2), use_container_width = True)
|
958 |
-
st.download_button(
|
959 |
-
label="Export Exposures",
|
960 |
-
data=convert_df_to_csv(qb_freq),
|
961 |
-
file_name='qb_freq_export.csv',
|
962 |
-
mime='text/csv',
|
963 |
-
)
|
964 |
-
with tab3:
|
965 |
-
st.dataframe(rb_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(freq_format, precision=2), use_container_width = True)
|
966 |
-
st.download_button(
|
967 |
-
label="Export Exposures",
|
968 |
-
data=convert_df_to_csv(rb_freq),
|
969 |
-
file_name='rb_freq_export.csv',
|
970 |
-
mime='text/csv',
|
971 |
-
)
|
972 |
-
with tab4:
|
973 |
-
st.dataframe(wr_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(freq_format, precision=2), use_container_width = True)
|
974 |
-
st.download_button(
|
975 |
-
label="Export Exposures",
|
976 |
-
data=convert_df_to_csv(wr_freq),
|
977 |
-
file_name='wr_freq_export.csv',
|
978 |
-
mime='text/csv',
|
979 |
-
)
|
980 |
-
with tab5:
|
981 |
-
st.dataframe(te_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(freq_format, precision=2), use_container_width = True)
|
982 |
-
st.download_button(
|
983 |
-
label="Export Exposures",
|
984 |
-
data=convert_df_to_csv(te_freq),
|
985 |
-
file_name='te_freq_export.csv',
|
986 |
-
mime='text/csv',
|
987 |
-
)
|
988 |
-
with tab6:
|
989 |
-
st.dataframe(flex_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(freq_format, precision=2), use_container_width = True)
|
990 |
-
st.download_button(
|
991 |
-
label="Export Exposures",
|
992 |
-
data=convert_df_to_csv(flex_freq),
|
993 |
-
file_name='flex_freq_export.csv',
|
994 |
-
mime='text/csv',
|
995 |
-
)
|
996 |
-
with tab7:
|
997 |
-
st.dataframe(dst_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(freq_format, precision=2), use_container_width = True)
|
998 |
-
st.download_button(
|
999 |
-
label="Export Exposures",
|
1000 |
-
data=convert_df_to_csv(dst_freq),
|
1001 |
-
file_name='dst_freq_export.csv',
|
1002 |
-
mime='text/csv',
|
1003 |
-
)
|
1004 |
|
1005 |
if st.button("Simulate Contest"):
|
1006 |
with st.container():
|
|
|
919 |
dst_freq = pd.DataFrame()
|
920 |
|
921 |
with col2:
|
922 |
+
if sim_done == 1:
|
923 |
+
player_split_var2 = st.radio("Are you wanting to isolate any lineups with specific players?", ('Full Players', 'Specific Players'))
|
924 |
+
if player_split_var2 == 'Specific Players':
|
925 |
+
find_var2 = st.multiselect('Which players must be included in the lineups?', options = player_freq['Player'].unique())
|
926 |
+
elif player_split_var2 == 'Full Players':
|
927 |
+
find_var2 = static_exposure.Player.values.tolist()
|
928 |
+
if player_split_var2 == 'Specific Players':
|
929 |
+
Sim_Winner_Frame = Sim_Winner_Frame[np.equal.outer(Sim_Winner_Frame.to_numpy(copy=False), find_var2).any(axis=1).all(axis=1)]
|
930 |
+
elif player_split_var2 == 'Full Players':
|
931 |
+
Sim_Winner_Frame = Sim_Winner_Frame
|
932 |
+
|
933 |
+
with st.container():
|
934 |
+
display_winner_dataframe = Sim_Winner_Frame.copy()
|
935 |
+
st.dataframe(display_winner_dataframe.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').background_gradient(cmap='RdYlGn_r', subset=['Own']).format(precision=2), use_container_width = True)
|
936 |
+
|
937 |
+
st.download_button(
|
938 |
+
label="Export Tables",
|
939 |
+
data=convert_df_to_csv(Sim_Winner_Export),
|
940 |
+
file_name='NFL_consim_export.csv',
|
941 |
+
mime='text/csv',
|
942 |
+
)
|
943 |
+
|
944 |
+
with st.container():
|
945 |
+
freq_container = st.empty()
|
946 |
+
tab1, tab2, tab3, tab4, tab5, tab6, tab7 = st.tabs(['Overall Exposures', 'QB Exposures', 'RB Exposures', 'WR Exposures', 'TE Exposures', 'FLEX Exposures', 'DST Exposures'])
|
947 |
+
with tab1:
|
948 |
+
st.dataframe(player_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(freq_format, precision=2), use_container_width = True)
|
949 |
st.download_button(
|
950 |
+
label="Export Exposures",
|
951 |
+
data=convert_df_to_csv(player_freq),
|
952 |
+
file_name='player_freq_export.csv',
|
953 |
+
mime='text/csv',
|
954 |
+
)
|
955 |
+
with tab2:
|
956 |
+
st.dataframe(qb_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(freq_format, precision=2), use_container_width = True)
|
957 |
+
st.download_button(
|
958 |
+
label="Export Exposures",
|
959 |
+
data=convert_df_to_csv(qb_freq),
|
960 |
+
file_name='qb_freq_export.csv',
|
961 |
+
mime='text/csv',
|
962 |
+
)
|
963 |
+
with tab3:
|
964 |
+
st.dataframe(rb_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(freq_format, precision=2), use_container_width = True)
|
965 |
+
st.download_button(
|
966 |
+
label="Export Exposures",
|
967 |
+
data=convert_df_to_csv(rb_freq),
|
968 |
+
file_name='rb_freq_export.csv',
|
969 |
+
mime='text/csv',
|
970 |
+
)
|
971 |
+
with tab4:
|
972 |
+
st.dataframe(wr_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(freq_format, precision=2), use_container_width = True)
|
973 |
+
st.download_button(
|
974 |
+
label="Export Exposures",
|
975 |
+
data=convert_df_to_csv(wr_freq),
|
976 |
+
file_name='wr_freq_export.csv',
|
977 |
+
mime='text/csv',
|
978 |
+
)
|
979 |
+
with tab5:
|
980 |
+
st.dataframe(te_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(freq_format, precision=2), use_container_width = True)
|
981 |
+
st.download_button(
|
982 |
+
label="Export Exposures",
|
983 |
+
data=convert_df_to_csv(te_freq),
|
984 |
+
file_name='te_freq_export.csv',
|
985 |
+
mime='text/csv',
|
986 |
+
)
|
987 |
+
with tab6:
|
988 |
+
st.dataframe(flex_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(freq_format, precision=2), use_container_width = True)
|
989 |
+
st.download_button(
|
990 |
+
label="Export Exposures",
|
991 |
+
data=convert_df_to_csv(flex_freq),
|
992 |
+
file_name='flex_freq_export.csv',
|
993 |
+
mime='text/csv',
|
994 |
+
)
|
995 |
+
with tab7:
|
996 |
+
st.dataframe(dst_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(freq_format, precision=2), use_container_width = True)
|
997 |
+
st.download_button(
|
998 |
+
label="Export Exposures",
|
999 |
+
data=convert_df_to_csv(dst_freq),
|
1000 |
+
file_name='dst_freq_export.csv',
|
1001 |
mime='text/csv',
|
1002 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1003 |
|
1004 |
if st.button("Simulate Contest"):
|
1005 |
with st.container():
|