James McCool commited on
Commit
4d75bf8
·
1 Parent(s): 4d2cf7c

Update export file handling in app.py: add logic to initialize the export file from the portfolio when no export file exists, enhancing data management and ensuring a seamless user experience during portfolio updates.

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -939,6 +939,8 @@ with tab3:
939
  if col not in excluded_cols:
940
  st.session_state['export_file'][col] = st.session_state['export_file'][col].map(st.session_state['export_dict'])
941
  st.write('Export portfolio updated!')
 
 
942
  if 'export_file' in st.session_state:
943
  st.download_button(label="Download Portfolio", data=st.session_state['export_file'].to_csv(index=False), file_name="portfolio.csv", mime="text/csv")
944
  else:
 
939
  if col not in excluded_cols:
940
  st.session_state['export_file'][col] = st.session_state['export_file'][col].map(st.session_state['export_dict'])
941
  st.write('Export portfolio updated!')
942
+ else:
943
+ st.session_state['export_file'] = st.session_state['portfolio'].copy()
944
  if 'export_file' in st.session_state:
945
  st.download_button(label="Download Portfolio", data=st.session_state['export_file'].to_csv(index=False), file_name="portfolio.csv", mime="text/csv")
946
  else: