James McCool
commited on
Commit
·
4d2cf7c
1
Parent(s):
602712b
Update download button logic in app.py: modify the export file availability check to ensure the download button is only shown when the export file exists, improving user experience and preventing errors during download attempts.
Browse files
app.py
CHANGED
@@ -939,10 +939,10 @@ 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 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
|
947 |
# Add pagination controls below the dataframe
|
948 |
total_rows = len(st.session_state['portfolio'])
|
|
|
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:
|
945 |
+
st.error("No portfolio to download")
|
946 |
|
947 |
# Add pagination controls below the dataframe
|
948 |
total_rows = len(st.session_state['portfolio'])
|