James McCool
commited on
Commit
·
90fa87c
1
Parent(s):
45bb52c
Refactor custom export options in app.py: reorganize layout to separate buttons for adding all and selected rows to the custom export, improving user interface clarity and functionality.
Browse files
app.py
CHANGED
@@ -1201,22 +1201,20 @@ with tab2:
|
|
1201 |
st.session_state['export_file'][col] = st.session_state['export_file'][col].map(st.session_state['export_dict'])
|
1202 |
|
1203 |
if 'export_file' in st.session_state:
|
1204 |
-
download_port, merge_port, clear_export, blank_export_col = st.columns([1, 1, 1, 8])
|
1205 |
with download_port:
|
1206 |
st.download_button(label="Download Portfolio", data=st.session_state['export_file'].to_csv(index=False), file_name="portfolio.csv", mime="text/csv")
|
1207 |
with merge_port:
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
st.session_state['export_base'] = st.session_state['export_base'].drop_duplicates()
|
1219 |
-
st.session_state['export_base'] = st.session_state['export_base'].reset_index(drop=True)
|
1220 |
with clear_export:
|
1221 |
if st.button("Clear Custom Export"):
|
1222 |
st.session_state['export_base'] = pd.DataFrame(columns=st.session_state['working_frame'].columns)
|
|
|
1201 |
st.session_state['export_file'][col] = st.session_state['export_file'][col].map(st.session_state['export_dict'])
|
1202 |
|
1203 |
if 'export_file' in st.session_state:
|
1204 |
+
download_port, merge_port, partial_col, clear_export, blank_export_col = st.columns([1, 1, 1, 8])
|
1205 |
with download_port:
|
1206 |
st.download_button(label="Download Portfolio", data=st.session_state['export_file'].to_csv(index=False), file_name="portfolio.csv", mime="text/csv")
|
1207 |
with merge_port:
|
1208 |
+
if st.button("Add all to Custom Export"):
|
1209 |
+
st.session_state['export_base'] = pd.concat([st.session_state['export_base'], st.session_state['export_merge']])
|
1210 |
+
st.session_state['export_base'] = st.session_state['export_base'].drop_duplicates()
|
1211 |
+
st.session_state['export_base'] = st.session_state['export_base'].reset_index(drop=True)
|
1212 |
+
with partial_col:
|
1213 |
+
select_custom_index = st.multiselect("Select rows to add to Custom Export", options=st.session_state['export_merge'].index, default=[])
|
1214 |
+
if st.button("Add selected to Custom Export"):
|
1215 |
+
st.session_state['export_base'] = pd.concat([st.session_state['export_base'], st.session_state['export_merge'].iloc[select_custom_index]])
|
1216 |
+
st.session_state['export_base'] = st.session_state['export_base'].drop_duplicates()
|
1217 |
+
st.session_state['export_base'] = st.session_state['export_base'].reset_index(drop=True)
|
|
|
|
|
1218 |
with clear_export:
|
1219 |
if st.button("Clear Custom Export"):
|
1220 |
st.session_state['export_base'] = pd.DataFrame(columns=st.session_state['working_frame'].columns)
|