James McCool
commited on
Commit
·
a5888d7
1
Parent(s):
89a6270
Implement portfolio reset feature in app.py: add functionality to restore the original portfolio state and streamline the reset process for improved user experience in managing projections.
Browse files
app.py
CHANGED
|
@@ -168,6 +168,8 @@ with tab1:
|
|
| 168 |
# Apply the matching
|
| 169 |
projections['upload_match'] = projections['player_names'].apply(find_best_match)
|
| 170 |
st.session_state['export_dict'] = dict(zip(projections['player_names'], projections['upload_match']))
|
|
|
|
|
|
|
| 171 |
|
| 172 |
with tab2:
|
| 173 |
if st.button('Clear data', key='reset2'):
|
|
@@ -683,13 +685,14 @@ with tab2:
|
|
| 683 |
|
| 684 |
with tab3:
|
| 685 |
if 'portfolio' in st.session_state and 'projections_df' in st.session_state:
|
| 686 |
-
st.session_state['origin_portfolio'] = st.session_state['portfolio'].copy()
|
| 687 |
|
| 688 |
excluded_cols = ['salary', 'median', 'Own', 'Finish_percentile', 'Dupes', 'Stack', 'Win%', 'Lineup Edge']
|
| 689 |
with st.container():
|
| 690 |
col1, col2, col3 = st.columns(3)
|
| 691 |
with col1:
|
| 692 |
site_var = st.selectbox("Select Site", ['Draftkings', 'Fanduel'])
|
|
|
|
|
|
|
| 693 |
if st.button('Clear data', key='reset3'):
|
| 694 |
st.session_state.clear()
|
| 695 |
|
|
@@ -802,11 +805,7 @@ with tab3:
|
|
| 802 |
|
| 803 |
submitted = st.form_submit_button("Submit")
|
| 804 |
with st.expander('Trimming Options'):
|
| 805 |
-
|
| 806 |
-
st.session_state['portfolio'] = predict_dupes(st.session_state['origin_portfolio'], map_dict, site_var, type_var, Contest_Size, strength_var)
|
| 807 |
-
|
| 808 |
-
export_file = st.session_state['portfolio'].copy()
|
| 809 |
-
st.session_state['portfolio'] = st.session_state['portfolio'].sort_values(by='median', ascending=False)
|
| 810 |
with st.form(key='trim_form'):
|
| 811 |
performance_type = st.selectbox("Select Sorting variable", ['median', 'Finish_percentile'])
|
| 812 |
own_type = st.selectbox("Select trimming variable", ['Own', 'Weighted Own'])
|
|
|
|
| 168 |
# Apply the matching
|
| 169 |
projections['upload_match'] = projections['player_names'].apply(find_best_match)
|
| 170 |
st.session_state['export_dict'] = dict(zip(projections['player_names'], projections['upload_match']))
|
| 171 |
+
|
| 172 |
+
st.session_state['origin_portfolio'] = st.session_state['portfolio'].copy()
|
| 173 |
|
| 174 |
with tab2:
|
| 175 |
if st.button('Clear data', key='reset2'):
|
|
|
|
| 685 |
|
| 686 |
with tab3:
|
| 687 |
if 'portfolio' in st.session_state and 'projections_df' in st.session_state:
|
|
|
|
| 688 |
|
| 689 |
excluded_cols = ['salary', 'median', 'Own', 'Finish_percentile', 'Dupes', 'Stack', 'Win%', 'Lineup Edge']
|
| 690 |
with st.container():
|
| 691 |
col1, col2, col3 = st.columns(3)
|
| 692 |
with col1:
|
| 693 |
site_var = st.selectbox("Select Site", ['Draftkings', 'Fanduel'])
|
| 694 |
+
if st.button('Reset Portfolio', key='reset_port'):
|
| 695 |
+
st.session_state['portfolio'] = st.session_state['origin_portfolio'].copy()
|
| 696 |
if st.button('Clear data', key='reset3'):
|
| 697 |
st.session_state.clear()
|
| 698 |
|
|
|
|
| 805 |
|
| 806 |
submitted = st.form_submit_button("Submit")
|
| 807 |
with st.expander('Trimming Options'):
|
| 808 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 809 |
with st.form(key='trim_form'):
|
| 810 |
performance_type = st.selectbox("Select Sorting variable", ['median', 'Finish_percentile'])
|
| 811 |
own_type = st.selectbox("Select trimming variable", ['Own', 'Weighted Own'])
|