James McCool commited on
Commit
8ada274
·
1 Parent(s): bca2538

Add clear portfolio reset functionality in app.py

Browse files

- Introduced a button to clear the portfolio dataframe from session state, allowing users to reset their portfolio easily.
- This enhancement improves user experience by providing a straightforward way to manage portfolio data during uploads.

Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -179,6 +179,8 @@ with tab1:
179
 
180
  with portfolio_upload:
181
  st.info("If you have a portfolio of lineups, you can upload them here to see how they would have performed against the field")
 
 
182
  st.session_state['portfolio_file'] = st.file_uploader("Upload Portfolio File (CSV or Excel)", type=['csv', 'xlsx', 'xls'])
183
  try:
184
  st.session_state['portfolio_df'] = pd.read_csv(st.session_state['portfolio_file'])
 
179
 
180
  with portfolio_upload:
181
  st.info("If you have a portfolio of lineups, you can upload them here to see how they would have performed against the field")
182
+ if st.button('Clear portfolio', key='reset2'):
183
+ st.session_state['portfolio_df'] = None
184
  st.session_state['portfolio_file'] = st.file_uploader("Upload Portfolio File (CSV or Excel)", type=['csv', 'xlsx', 'xls'])
185
  try:
186
  st.session_state['portfolio_df'] = pd.read_csv(st.session_state['portfolio_file'])