James McCool commited on
Commit
f962e85
·
1 Parent(s): 40731d9

Refine dataframe styling in Streamlit app for pitcher tab

Browse files

- Added a positive set for 'K%' to enhance data representation.
- Simplified the background gradient application in the pitcher dataframe for improved visual clarity and consistency.

Files changed (1) hide show
  1. src/streamlit_app.py +2 -1
src/streamlit_app.py CHANGED
@@ -124,6 +124,7 @@ with pitcher_tab:
124
  else:
125
  disp_raw = disp_raw[disp_raw['Set'] == 'RHH']
126
  disp_raw = disp_raw[['Names', 'DK_Salary', 'FD_Salary', 'Team', 'Opp', 'Opp_TT', 'Hand', 'K%', 'BB%', 'True AVG', 'xSLG', 'xBA', 'Hits', 'xHRs', 'xHR/PA']]
 
127
  st.session_state['sp_disp_frame'] = disp_raw
128
  elif table_var_sp == 'League Aggregate Baselines':
129
  disp_raw = pitcher_agg
@@ -145,7 +146,7 @@ with pitcher_tab:
145
  sp_disp_container = sp_disp_container.empty()
146
 
147
  with sp_disp_container:
148
- st.dataframe(st.session_state['sp_disp_frame'].style.background_gradient(axis=0).background_gradient(cmap='RdYlGn_r').background_gradient(cmap='RdYlGn', subset=['Strikeoutper', 'Strikeouts', 'K%']).format(precision=2), use_container_width = True, hide_index = True)
149
 
150
  with hitter_tab:
151
  with st.expander('Info and Display Options'):
 
124
  else:
125
  disp_raw = disp_raw[disp_raw['Set'] == 'RHH']
126
  disp_raw = disp_raw[['Names', 'DK_Salary', 'FD_Salary', 'Team', 'Opp', 'Opp_TT', 'Hand', 'K%', 'BB%', 'True AVG', 'xSLG', 'xBA', 'Hits', 'xHRs', 'xHR/PA']]
127
+ positive_set = ['K%']
128
  st.session_state['sp_disp_frame'] = disp_raw
129
  elif table_var_sp == 'League Aggregate Baselines':
130
  disp_raw = pitcher_agg
 
146
  sp_disp_container = sp_disp_container.empty()
147
 
148
  with sp_disp_container:
149
+ st.dataframe(st.session_state['sp_disp_frame'].style.background_gradient(axis=0).background_gradient(cmap='RdYlGn_r').format(precision=2), use_container_width = True, hide_index = True)
150
 
151
  with hitter_tab:
152
  with st.expander('Info and Display Options'):