James McCool commited on
Commit
0b16f62
·
1 Parent(s): 97f24d7

Update download button logic in app.py: ensure the download button for the portfolio is only displayed when the export file is available, improving user experience and preventing errors during download attempts.

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -950,8 +950,8 @@ with tab3:
950
  export_file[col] = export_file[col].map(st.session_state['export_dict'])
951
  st.write('Export portfolio updated!')
952
  st.table(export_file)
953
-
954
- st.download_button(label="Download Portfolio", data=export_file.to_csv(index=False), file_name="portfolio.csv", mime="text/csv")
955
 
956
  # Add pagination controls below the dataframe
957
  total_rows = len(st.session_state['portfolio'])
 
950
  export_file[col] = export_file[col].map(st.session_state['export_dict'])
951
  st.write('Export portfolio updated!')
952
  st.table(export_file)
953
+ if export_file is not None:
954
+ st.download_button(label="Download Portfolio", data=export_file.to_csv(index=False), file_name="portfolio.csv", mime="text/csv")
955
 
956
  # Add pagination controls below the dataframe
957
  total_rows = len(st.session_state['portfolio'])