James McCool commited on
Commit
6313632
·
1 Parent(s): 865e405

Refactor player data display in app.py by simplifying the presentation of statistics. Removed the pivot table and directly displayed player metrics, enhancing clarity and improving the visual representation with background gradients. This change streamlines the data display process while maintaining the integrity of the information presented.

Browse files
Files changed (1) hide show
  1. app.py +2 -8
app.py CHANGED
@@ -358,14 +358,8 @@ if st.button("Run"):
358
  for player, tab in zip(unique_players, player_tabs):
359
  with tab:
360
  player_data = sim_df[sim_df['Player'] == player]
361
- # Pivot the table to make Stats the columns
362
- pivoted_data = player_data.pivot(columns='Stat', values=['10%', '25%', '50%', '75%', '90%'])
363
- # Reorder the index to match the original percentile order
364
- pivoted_data = pivoted_data.reindex(['10%', '25%', '50%', '75%', '90%'])
365
  st.dataframe(
366
- pivoted_data
367
- .style.background_gradient(axis=0)
368
- .background_gradient(cmap='RdYlGn')
369
- .format(precision=2),
370
  use_container_width=True
371
  )
 
358
  for player, tab in zip(unique_players, player_tabs):
359
  with tab:
360
  player_data = sim_df[sim_df['Player'] == player]
 
 
 
 
361
  st.dataframe(
362
+ player_data[['Stat', '10%', '25%', '50%', '75%', '90%']]
363
+ .style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2),
 
 
364
  use_container_width=True
365
  )