James McCool commited on
Commit
350005a
·
1 Parent(s): d806cb7

Update Streamlit app to store display frame in session state and enhance data presentation with conditional formatting. This change improves user experience by maintaining state across interactions and visually differentiating data values.

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +5 -3
src/streamlit_app.py CHANGED
@@ -31,7 +31,9 @@ st.title("HR Finder Table")
31
 
32
  disp_options = st.radio("Display options:", options = ['Exclude DFS Info', 'Include DFS Info'], key='display_options')
33
  if disp_options == 'Exclude DFS Info':
34
- disp_frame = hr_frame.drop(columns=['Salary', 'Position', 'FD_Position', 'Order'])
35
  else:
36
- disp_frame = hr_frame.copy()
37
- st.dataframe(disp_frame, use_container_width = True, hide_index = True)
 
 
 
31
 
32
  disp_options = st.radio("Display options:", options = ['Exclude DFS Info', 'Include DFS Info'], key='display_options')
33
  if disp_options == 'Exclude DFS Info':
34
+ st.session_state['disp_frame'] = hr_frame.drop(columns=['Salary', 'Position', 'FD_Position', 'Order'])
35
  else:
36
+ st.session_state['disp_frame'] = hr_frame.copy()
37
+
38
+ if 'disp_frame' in st.session_state:
39
+ st.dataframe(st.session_state['disp_frame'].background_gradient(axis=0).background_gradient(cmap = 'RdYlGn').format(precision=2), height=1200, use_container_width = True, hide_index = True)