Update app.py
Browse files
app.py
CHANGED
@@ -433,31 +433,6 @@ with tab3:
|
|
433 |
combo_file = pd.concat([cpt_proj, flex_proj], ignore_index=True)
|
434 |
|
435 |
with col2:
|
436 |
-
|
437 |
-
with st.container():
|
438 |
-
st.dataframe(display_baselines.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
|
439 |
-
st.download_button(
|
440 |
-
label="Export Projections",
|
441 |
-
data=convert_df_to_csv(export_baselines),
|
442 |
-
file_name='NFL_proj_export.csv',
|
443 |
-
mime='text/csv',
|
444 |
-
)
|
445 |
-
|
446 |
-
with st.container():
|
447 |
-
if 'portfolio' in st.session_state:
|
448 |
-
st.dataframe(st.session_state.portfolio.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
|
449 |
-
if 'final_outcomes_export' in st.session_state:
|
450 |
-
st.download_button(
|
451 |
-
label="Export Tables",
|
452 |
-
data=convert_df_to_csv(st.session_state.final_outcomes_export),
|
453 |
-
file_name='MLB_optimals_export.csv',
|
454 |
-
mime='text/csv',
|
455 |
-
)
|
456 |
-
|
457 |
-
with st.container():
|
458 |
-
if 'player_freq' in st.session_state:
|
459 |
-
st.dataframe(st.session_state.player_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(expose_format, precision=2), use_container_width = True)
|
460 |
-
|
461 |
if st.button('Optimize'):
|
462 |
for key in st.session_state.keys():
|
463 |
del st.session_state[key]
|
@@ -466,6 +441,8 @@ with tab3:
|
|
466 |
total_proj = 0
|
467 |
total_own = 0
|
468 |
optimize_container = st.empty()
|
|
|
|
|
469 |
lineup_display = []
|
470 |
check_list = []
|
471 |
lineups = []
|
@@ -473,7 +450,7 @@ with tab3:
|
|
473 |
x = 1
|
474 |
|
475 |
with st.spinner('Wait for it...'):
|
476 |
-
with
|
477 |
|
478 |
while x <= linenum_var1:
|
479 |
sorted_lineup = []
|
@@ -631,6 +608,7 @@ with tab3:
|
|
631 |
st.session_state.portfolio = portfolio.drop_duplicates()
|
632 |
|
633 |
final_outcomes = portfolio
|
|
|
634 |
|
635 |
player_freq = pd.DataFrame(np.column_stack(np.unique(st.session_state.portfolio.iloc[:,0:5].values, return_counts=True)),
|
636 |
columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
|
@@ -710,4 +688,20 @@ with tab3:
|
|
710 |
|
711 |
st.session_state.final_outcomes_export = final_outcomes_export.copy()
|
712 |
|
713 |
-
st.session_state.player_freq = player_freq[['Player', 'Position', 'Team', 'Salary', 'Proj Own', 'Exposure']]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
433 |
combo_file = pd.concat([cpt_proj, flex_proj], ignore_index=True)
|
434 |
|
435 |
with col2:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
436 |
if st.button('Optimize'):
|
437 |
for key in st.session_state.keys():
|
438 |
del st.session_state[key]
|
|
|
441 |
total_proj = 0
|
442 |
total_own = 0
|
443 |
optimize_container = st.empty()
|
444 |
+
download_container = st.empty()
|
445 |
+
freq_container = st.empty()
|
446 |
lineup_display = []
|
447 |
check_list = []
|
448 |
lineups = []
|
|
|
450 |
x = 1
|
451 |
|
452 |
with st.spinner('Wait for it...'):
|
453 |
+
with optimize_container:
|
454 |
|
455 |
while x <= linenum_var1:
|
456 |
sorted_lineup = []
|
|
|
608 |
st.session_state.portfolio = portfolio.drop_duplicates()
|
609 |
|
610 |
final_outcomes = portfolio
|
611 |
+
st.session_state.final_outcomes = portfolio
|
612 |
|
613 |
player_freq = pd.DataFrame(np.column_stack(np.unique(st.session_state.portfolio.iloc[:,0:5].values, return_counts=True)),
|
614 |
columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
|
|
|
688 |
|
689 |
st.session_state.final_outcomes_export = final_outcomes_export.copy()
|
690 |
|
691 |
+
st.session_state.player_freq = player_freq[['Player', 'Position', 'Team', 'Salary', 'Proj Own', 'Exposure']]
|
692 |
+
|
693 |
+
with optimize_container:
|
694 |
+
optimize_container = st.empty()
|
695 |
+
st.dataframe(st.session_state.final_outcomes.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
|
696 |
+
with download_container:
|
697 |
+
download_container = st.empty()
|
698 |
+
st.download_button(
|
699 |
+
label="Export Optimals",
|
700 |
+
data=convert_df_to_csv(st.session_state.final_outcomes_export),
|
701 |
+
file_name='NFL_optimals_export.csv',
|
702 |
+
mime='text/csv',
|
703 |
+
)
|
704 |
+
with freq_container:
|
705 |
+
freq_container = st.empty()
|
706 |
+
st.dataframe(st.session_state.player_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(expose_format, precision=2), use_container_width = True)
|
707 |
+
|