James McCool commited on
Commit
7107abb
·
1 Parent(s): 11e981b

Refactor overall simulation data handling in app.py. Updated overall_sim_df to drop duplicate entries based on 'Player', 'Position', and 'Stat', and set 'Player' as the index for improved data organization. Adjusted the placement of the "Individual Game Simulations" subheader for better clarity in the user interface. These changes enhance the readability and usability of simulation results.

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -424,7 +424,8 @@ if st.button("Run"):
424
  '90%': percentiles[stat][4]
425
  })
426
 
427
- overall_sim_df = pd.DataFrame(overall_sim_results)
 
428
 
429
  tab1, tab2 = st.tabs(["Team Data", "Opponent Data"])
430
  with tab1:
@@ -435,10 +436,10 @@ if st.button("Run"):
435
  with tab2:
436
  st.dataframe(opp_boost.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
437
 
 
438
  unique_players = sim_df['Player'].unique().tolist()
439
  player_tabs = st.tabs(unique_players)
440
 
441
- st.subheader("Individual Game Simulations")
442
  for player, tab in zip(unique_players, player_tabs):
443
  with tab:
444
  player_data = sim_df[sim_df['Player'] == player]
 
424
  '90%': percentiles[stat][4]
425
  })
426
 
427
+ overall_sim_df = pd.DataFrame(overall_sim_results).drop_duplicates(subset = ['Player', 'Position', 'Stat'])
428
+ overall_sim_df = overall_sim_df.set_index(['Player'])
429
 
430
  tab1, tab2 = st.tabs(["Team Data", "Opponent Data"])
431
  with tab1:
 
436
  with tab2:
437
  st.dataframe(opp_boost.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
438
 
439
+ st.subheader("Individual Game Simulations")
440
  unique_players = sim_df['Player'].unique().tolist()
441
  player_tabs = st.tabs(unique_players)
442
 
 
443
  for player, tab in zip(unique_players, player_tabs):
444
  with tab:
445
  player_data = sim_df[sim_df['Player'] == player]