Spaces:
Running
Running
James McCool
commited on
Commit
·
865e405
1
Parent(s):
e39b810
Enhance player data display in app.py by pivoting statistics for improved clarity. Introduced a pivot table to reorganize player metrics, ensuring percentiles are displayed in the correct order. Updated the background gradient direction for better visual representation, enhancing user experience in analyzing player performance.
Browse files
app.py
CHANGED
@@ -358,8 +358,14 @@ 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 |
st.dataframe(
|
362 |
-
|
363 |
-
.style.background_gradient(axis=
|
|
|
|
|
364 |
use_container_width=True
|
365 |
)
|
|
|
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 |
)
|