James McCool commited on
Commit
85260c1
·
1 Parent(s): db75e00

Enhance dataframe display in app.py by applying styled formatting and column configurations for improved visual representation. This update includes background gradients and custom number columns to better convey statistical data in the user interface.

Browse files
Files changed (1) hide show
  1. app.py +31 -1
app.py CHANGED
@@ -1208,7 +1208,37 @@ with tab2:
1208
  current_page_data = display_frame.iloc[start_idx:end_idx]
1209
  # Display the paginated dataframe first
1210
  st.table(
1211
- current_page_data
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1212
  )
1213
  player_stats_col, stack_stats_col = st.tabs(['Player Stats', 'Stack Stats'])
1214
  with player_stats_col:
 
1208
  current_page_data = display_frame.iloc[start_idx:end_idx]
1209
  # Display the paginated dataframe first
1210
  st.table(
1211
+ current_page_data.style
1212
+ .background_gradient(axis=0)
1213
+ .background_gradient(cmap='RdYlGn')
1214
+ .background_gradient(cmap='RdYlGn_r', subset=['Finish_percentile', 'Own', 'Dupes'])
1215
+ .format(freq_format, precision=2),
1216
+ column_config={
1217
+ "Finish_percentile": st.column_config.NumberColumn(
1218
+ "Finish%",
1219
+ help="Projected finishing percentile",
1220
+ width="small",
1221
+ min_value=0.0,
1222
+ max_value=1.0
1223
+ ),
1224
+ "Lineup Edge": st.column_config.NumberColumn(
1225
+ "Edge",
1226
+ help="Projected lineup edge",
1227
+ width="small",
1228
+ min_value=-1.0,
1229
+ max_value=1.0
1230
+ ),
1231
+ "Diversity": st.column_config.NumberColumn(
1232
+ "Diversity",
1233
+ help="Projected lineup diversity",
1234
+ width="small",
1235
+ min_value=0.0,
1236
+ max_value=1.0
1237
+ ),
1238
+ },
1239
+ height=500,
1240
+ use_container_width=True,
1241
+ hide_index=True
1242
  )
1243
  player_stats_col, stack_stats_col = st.tabs(['Player Stats', 'Stack Stats'])
1244
  with player_stats_col: