James McCool commited on
Commit
22ba691
Β·
1 Parent(s): f015507

Remove pagination logic from app.py for simplification

Browse files

- Commented out pagination initialization, total page calculation, and control buttons to streamline the data display process.
- Adjusted the display of the dataframe to show all data without pagination, enhancing clarity and usability.

Files changed (1) hide show
  1. app.py +21 -21
app.py CHANGED
@@ -176,31 +176,31 @@ with tab2:
176
  working_df['dupes'] = working_df.groupby('sorted').transform('size')
177
  working_df = working_df.drop('sorted', axis=1)
178
 
179
- # Initialize pagination in session state if not exists
180
- if 'current_page' not in st.session_state:
181
- st.session_state.current_page = 0
182
 
183
- # Calculate total pages
184
- rows_per_page = 500
185
- total_rows = len(working_df)
186
- total_pages = (total_rows + rows_per_page - 1) // rows_per_page
187
 
188
- # Create pagination controls in a single row
189
- pagination_cols = st.columns([4, 1, 1, 1, 4])
190
- with pagination_cols[1]:
191
- if st.button("← Previous", disabled=st.session_state.current_page == 0):
192
- st.session_state.current_page -= 1
193
- with pagination_cols[2]:
194
- st.markdown(f"**Page {st.session_state.current_page + 1} of {total_pages}**", unsafe_allow_html=True)
195
- with pagination_cols[3]:
196
- if st.button("Next β†’", disabled=st.session_state.current_page == total_pages - 1):
197
- st.session_state.current_page += 1
198
 
199
- # Calculate start and end indices for current page
200
- start_idx = st.session_state.current_page * rows_per_page
201
- end_idx = min((st.session_state.current_page + 1) * rows_per_page, total_rows)
202
 
203
  # Display the paginated dataframe
204
  st.table(
205
- working_df.iloc[start_idx:end_idx]
206
  )
 
176
  working_df['dupes'] = working_df.groupby('sorted').transform('size')
177
  working_df = working_df.drop('sorted', axis=1)
178
 
179
+ # # Initialize pagination in session state if not exists
180
+ # if 'current_page' not in st.session_state:
181
+ # st.session_state.current_page = 0
182
 
183
+ # # Calculate total pages
184
+ # rows_per_page = 500
185
+ # total_rows = len(working_df)
186
+ # total_pages = (total_rows + rows_per_page - 1) // rows_per_page
187
 
188
+ # # Create pagination controls in a single row
189
+ # pagination_cols = st.columns([4, 1, 1, 1, 4])
190
+ # with pagination_cols[1]:
191
+ # if st.button("← Previous", disabled=st.session_state.current_page == 0):
192
+ # st.session_state.current_page -= 1
193
+ # with pagination_cols[2]:
194
+ # st.markdown(f"**Page {st.session_state.current_page + 1} of {total_pages}**", unsafe_allow_html=True)
195
+ # with pagination_cols[3]:
196
+ # if st.button("Next β†’", disabled=st.session_state.current_page == total_pages - 1):
197
+ # st.session_state.current_page += 1
198
 
199
+ # # Calculate start and end indices for current page
200
+ # start_idx = st.session_state.current_page * rows_per_page
201
+ # end_idx = min((st.session_state.current_page + 1) * rows_per_page, total_rows)
202
 
203
  # Display the paginated dataframe
204
  st.table(
205
+ working_df
206
  )