James McCool commited on
Commit
b4fbe69
·
1 Parent(s): c1c7c16

Enhance player exposure dataframe display in app.py

Browse files

- Updated the logic for displaying the player exposure dataframe to include a more precise percentage formatting for numeric columns.
- Maintained the sorting and background gradient features, improving the overall clarity and visual appeal of the data presentation.

Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -212,7 +212,11 @@ with tab2:
212
  else:
213
  st.session_state['player_frame'] = pd.merge(st.session_state['player_frame'], set_frame, on='Player', how='outer')
214
  count_var += 1
215
- st.dataframe(st.session_state['player_frame'].sort_values(by='Exposure Overall', ascending=False).style.background_gradient(cmap='RdYlGn').format(player_exposure_format, precision=2), hide_index=True)
 
 
 
 
216
  with tab2:
217
  stack_counts = pd.Series(list(working_df['stack'])).value_counts()
218
  stack_frame = stack_counts.to_frame().reset_index().rename(columns={'index': 'Stack', 'count': 'Count'})
 
212
  else:
213
  st.session_state['player_frame'] = pd.merge(st.session_state['player_frame'], set_frame, on='Player', how='outer')
214
  count_var += 1
215
+ st.dataframe(st.session_state['player_frame'].
216
+ sort_values(by='Exposure Overall', ascending=False).
217
+ style.background_gradient(cmap='RdYlGn').
218
+ format(formatter='{:.2%}', subset=st.session_state['player_frame'].select_dtypes(include=['number']).columns),
219
+ hide_index=True)
220
  with tab2:
221
  stack_counts = pd.Series(list(working_df['stack'])).value_counts()
222
  stack_frame = stack_counts.to_frame().reset_index().rename(columns={'index': 'Stack', 'count': 'Count'})