Update app.py
Browse files
app.py
CHANGED
@@ -329,6 +329,21 @@ with tab3:
|
|
329 |
min_sal1 = st.number_input('Min Salary', min_value = 45000, max_value = 59900, value = 59000, step = 100, key='min_sal1')
|
330 |
max_sal1 = st.number_input('Max Salary', min_value = 45000, max_value = 60000, value = 60000, step = 100, key='max_sal1')
|
331 |
with col2:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
332 |
if contest_var1 == 'Small Field GPP':
|
333 |
if site_var1 == 'Draftkings':
|
334 |
ownframe = raw_baselines.copy()
|
@@ -609,7 +624,7 @@ with tab3:
|
|
609 |
portfolio.rename(columns={'Lineup_num': "Lineup"}, inplace = True)
|
610 |
portfolio = portfolio.set_index('Lineup')
|
611 |
portfolio = portfolio.drop(columns=['index'])
|
612 |
-
portfolio = portfolio.drop_duplicates()
|
613 |
|
614 |
final_outcomes = portfolio
|
615 |
|
@@ -658,6 +673,8 @@ with tab3:
|
|
658 |
final_outcomes_export['Own'] = final_outcomes['Own']
|
659 |
final_outcomes_export['Proj'] = final_outcomes['Proj']
|
660 |
|
|
|
|
|
661 |
elif site_var1 == 'Fanduel':
|
662 |
|
663 |
split_portfolio[['CPT', 'CPT_ID']] = final_outcomes.CPT.str.split("-", n=1, expand = True)
|
@@ -686,19 +703,9 @@ with tab3:
|
|
686 |
final_outcomes_export['Salary'] = final_outcomes['Cost']
|
687 |
final_outcomes_export['Own'] = final_outcomes['Own']
|
688 |
final_outcomes_export['Proj'] = final_outcomes['Proj']
|
|
|
|
|
689 |
|
690 |
-
player_freq = player_freq[['Player', 'Position', 'Team', 'Salary', 'Proj Own', 'Exposure']]
|
691 |
-
player_freq = player_freq.set_index('Player')
|
692 |
-
|
693 |
-
with st.container():
|
694 |
-
st.dataframe(portfolio.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
|
695 |
|
696 |
-
st.download_button(
|
697 |
-
label="Export Tables",
|
698 |
-
data=convert_df_to_csv(final_outcomes),
|
699 |
-
file_name='MLB_optimals_export.csv',
|
700 |
-
mime='text/csv',
|
701 |
-
)
|
702 |
|
703 |
-
with st.container():
|
704 |
-
st.dataframe(player_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(expose_format, precision=2), use_container_width = True)
|
|
|
329 |
min_sal1 = st.number_input('Min Salary', min_value = 45000, max_value = 59900, value = 59000, step = 100, key='min_sal1')
|
330 |
max_sal1 = st.number_input('Max Salary', min_value = 45000, max_value = 60000, value = 60000, step = 100, key='max_sal1')
|
331 |
with col2:
|
332 |
+
|
333 |
+
with st.container():
|
334 |
+
if 'portfolio' in st.session_state:
|
335 |
+
st.dataframe(st.session_state.portfolio.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
|
336 |
+
if 'final_outcomes_export' in st.session_state:
|
337 |
+
st.download_button(
|
338 |
+
label="Export Tables",
|
339 |
+
data=convert_df_to_csv(st.session_state.final_outcomes_export),
|
340 |
+
file_name='MLB_optimals_export.csv',
|
341 |
+
mime='text/csv',
|
342 |
+
)
|
343 |
+
|
344 |
+
with st.container():
|
345 |
+
if 'player_freq' in st.session_state:
|
346 |
+
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)
|
347 |
if contest_var1 == 'Small Field GPP':
|
348 |
if site_var1 == 'Draftkings':
|
349 |
ownframe = raw_baselines.copy()
|
|
|
624 |
portfolio.rename(columns={'Lineup_num': "Lineup"}, inplace = True)
|
625 |
portfolio = portfolio.set_index('Lineup')
|
626 |
portfolio = portfolio.drop(columns=['index'])
|
627 |
+
st.session_state.portfolio = portfolio.drop_duplicates()
|
628 |
|
629 |
final_outcomes = portfolio
|
630 |
|
|
|
673 |
final_outcomes_export['Own'] = final_outcomes['Own']
|
674 |
final_outcomes_export['Proj'] = final_outcomes['Proj']
|
675 |
|
676 |
+
st.session_state.final_outcomes_export = final_outcomes_export.copy()
|
677 |
+
|
678 |
elif site_var1 == 'Fanduel':
|
679 |
|
680 |
split_portfolio[['CPT', 'CPT_ID']] = final_outcomes.CPT.str.split("-", n=1, expand = True)
|
|
|
703 |
final_outcomes_export['Salary'] = final_outcomes['Cost']
|
704 |
final_outcomes_export['Own'] = final_outcomes['Own']
|
705 |
final_outcomes_export['Proj'] = final_outcomes['Proj']
|
706 |
+
|
707 |
+
st.session_state.final_outcomes_export = final_outcomes_export.copy()
|
708 |
|
709 |
+
st.session_state.player_freq = player_freq[['Player', 'Position', 'Team', 'Salary', 'Proj Own', 'Exposure']]
|
|
|
|
|
|
|
|
|
710 |
|
|
|
|
|
|
|
|
|
|
|
|
|
711 |
|
|
|
|