James McCool commited on
Commit
026f31b
·
1 Parent(s): f29027b

Refactor player data handling in init_team_data function of app.py. Updated results_dict assignment to drop NaN values, ensuring cleaner data output for each game iteration. Adjusted playername indexing to maintain clarity in player statistics during simulations. This change enhances the overall quality and usability of the player summary data.

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -343,7 +343,7 @@ def init_team_data(team, opponent, win_loss_settings, kill_predictions, death_pr
343
  team_data['CS_Proj'] = team_data.apply(lambda row: row['lCS'] * opp_pos_cs_boost_loss.get(row['position'], 1), axis=1)
344
  team_data = team_data[['playername', 'teamname', 'position', 'Kill_Proj', 'Death_Proj', 'Assist_Proj', 'CS_Proj']]
345
 
346
- results_dict[f'game {game + 1}'] = team_data
347
  team_data['playername'] = team_data['playername'] + f' game {game + 1}'
348
 
349
  overall_team_data = pd.concat([overall_team_data, team_data])
@@ -366,7 +366,7 @@ if st.button("Run"):
366
  player_summary.update(clean_df) # Update teamname and position if needed
367
  for col in ['Kill_Proj', 'Death_Proj', 'Assist_Proj', 'CS_Proj']:
368
  player_summary[col] += clean_df[col]
369
- player_summary = player_summary.set_index('playername')
370
 
371
  # Create simulated percentiles
372
  sim_results = []
 
343
  team_data['CS_Proj'] = team_data.apply(lambda row: row['lCS'] * opp_pos_cs_boost_loss.get(row['position'], 1), axis=1)
344
  team_data = team_data[['playername', 'teamname', 'position', 'Kill_Proj', 'Death_Proj', 'Assist_Proj', 'CS_Proj']]
345
 
346
+ results_dict[f'game {game + 1}'] = team_data.dropna()
347
  team_data['playername'] = team_data['playername'] + f' game {game + 1}'
348
 
349
  overall_team_data = pd.concat([overall_team_data, team_data])
 
366
  player_summary.update(clean_df) # Update teamname and position if needed
367
  for col in ['Kill_Proj', 'Death_Proj', 'Assist_Proj', 'CS_Proj']:
368
  player_summary[col] += clean_df[col]
369
+ player_summary = player_summary.set_index('playername')
370
 
371
  # Create simulated percentiles
372
  sim_results = []