gilalnauman commited on
Commit
3da301f
·
verified ·
1 Parent(s): 84cfd97

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -18
app.py CHANGED
@@ -298,19 +298,16 @@ if filtered_df.empty:
298
  st.warning("No results found. Try adjusting the filters.")
299
  else:
300
  # Pagination controls
301
- page_size = st.sidebar.selectbox("Rows per page", [10, 20, 50], index=0)
302
- page_number = st.sidebar.number_input(
303
- "Page number",
304
- min_value=1,
305
- max_value=(len(filtered_df) // page_size) + 1,
306
- step=1,
307
- value=1
308
- )
309
- start_index = (page_number - 1) * page_size
310
- end_index = start_index + page_size
311
 
312
- # Paginated table
313
- st.dataframe(filtered_df.iloc[start_index:end_index], use_container_width=True)
 
 
 
314
 
315
  # Visualization of selected metric
316
  st.subheader("Performance Metrics Visualization")
@@ -376,12 +373,7 @@ else:
376
  mime="text/csv"
377
  )
378
 
379
-
380
-
381
-
382
-
383
-
384
- # with bubble plot
385
 
386
  # import streamlit as st
387
  # import pandas as pd
 
298
  st.warning("No results found. Try adjusting the filters.")
299
  else:
300
  # Pagination controls
301
+ total_rows = len(filtered_df)
302
+ page_size = st.sidebar.selectbox("Rows per page", [5, 10, 20, 50], index=1)
303
+ total_pages = (total_rows + page_size - 1) // page_size # Calculate total pages
304
+ page_number = st.sidebar.slider("Page number", 1, total_pages, 1)
 
 
 
 
 
 
305
 
306
+ # Display current page rows
307
+ start_idx = (page_number - 1) * page_size
308
+ end_idx = start_idx + page_size
309
+ st.write(f"Displaying rows {start_idx + 1} to {min(end_idx, total_rows)} of {total_rows}")
310
+ st.dataframe(filtered_df.iloc[start_idx:end_idx], use_container_width=True)
311
 
312
  # Visualization of selected metric
313
  st.subheader("Performance Metrics Visualization")
 
373
  mime="text/csv"
374
  )
375
 
376
+ # with bubble plot
 
 
 
 
 
377
 
378
  # import streamlit as st
379
  # import pandas as pd