James McCool
commited on
Commit
·
099dd08
1
Parent(s):
773ad73
Refactor pagination logic in app.py: move dataframe display to the correct position for improved user experience and clarity.
Browse files
app.py
CHANGED
|
@@ -905,16 +905,7 @@ with tab3:
|
|
| 905 |
st.write('Export portfolio updated!')
|
| 906 |
|
| 907 |
st.download_button(label="Download Portfolio", data=export_file.to_csv(index=False), file_name="portfolio.csv", mime="text/csv")
|
| 908 |
-
|
| 909 |
-
st.dataframe(
|
| 910 |
-
st.session_state['portfolio'].style
|
| 911 |
-
.background_gradient(axis=0)
|
| 912 |
-
.background_gradient(cmap='RdYlGn')
|
| 913 |
-
.background_gradient(cmap='RdYlGn_r', subset=['Finish_percentile', 'Own', 'Dupes'])
|
| 914 |
-
.format(freq_format, precision=2),
|
| 915 |
-
height=1000,
|
| 916 |
-
use_container_width=True
|
| 917 |
-
)
|
| 918 |
|
| 919 |
# Add pagination controls below the dataframe
|
| 920 |
total_rows = len(st.session_state['portfolio'])
|
|
@@ -945,6 +936,16 @@ with tab3:
|
|
| 945 |
|
| 946 |
# Get the subset of data for the current page
|
| 947 |
current_page_data = st.session_state['portfolio'].iloc[start_idx:end_idx]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 948 |
|
| 949 |
# Create player summary dataframe
|
| 950 |
player_stats = []
|
|
|
|
| 905 |
st.write('Export portfolio updated!')
|
| 906 |
|
| 907 |
st.download_button(label="Download Portfolio", data=export_file.to_csv(index=False), file_name="portfolio.csv", mime="text/csv")
|
| 908 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 909 |
|
| 910 |
# Add pagination controls below the dataframe
|
| 911 |
total_rows = len(st.session_state['portfolio'])
|
|
|
|
| 936 |
|
| 937 |
# Get the subset of data for the current page
|
| 938 |
current_page_data = st.session_state['portfolio'].iloc[start_idx:end_idx]
|
| 939 |
+
# Display the paginated dataframe first
|
| 940 |
+
st.dataframe(
|
| 941 |
+
st.session_state['portfolio'].style
|
| 942 |
+
.background_gradient(axis=0)
|
| 943 |
+
.background_gradient(cmap='RdYlGn')
|
| 944 |
+
.background_gradient(cmap='RdYlGn_r', subset=['Finish_percentile', 'Own', 'Dupes'])
|
| 945 |
+
.format(freq_format, precision=2),
|
| 946 |
+
height=1000,
|
| 947 |
+
use_container_width=True
|
| 948 |
+
)
|
| 949 |
|
| 950 |
# Create player summary dataframe
|
| 951 |
player_stats = []
|