Spaces:
Running
Running
James McCool
commited on
Commit
·
e67403e
1
Parent(s):
14d978b
Refactor player summary generation in app.py to correctly iterate over results_dict using game number keys. Updated player summary aggregation logic to ensure team names and positions are accurately reflected. This change enhances data accuracy and improves the clarity of player statistics during simulations.
Browse files
app.py
CHANGED
@@ -354,7 +354,8 @@ if st.button("Run"):
|
|
354 |
team_data, opp_boost, results_dict = init_team_data(selected_team, selected_opponent, win_loss_settings, kill_predictions, death_predictions, start_date, end_date)
|
355 |
|
356 |
player_summary = pd.DataFrame()
|
357 |
-
for
|
|
|
358 |
# Remove 'game X' from playernames if present
|
359 |
clean_df = game_df.copy()
|
360 |
clean_df['playername'] = clean_df['playername'].str.split(' game ').str[0]
|
@@ -363,9 +364,12 @@ if st.button("Run"):
|
|
363 |
player_summary = clean_df
|
364 |
else:
|
365 |
# Add the stats to existing players
|
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
|
|
|
354 |
team_data, opp_boost, results_dict = init_team_data(selected_team, selected_opponent, win_loss_settings, kill_predictions, death_predictions, start_date, end_date)
|
355 |
|
356 |
player_summary = pd.DataFrame()
|
357 |
+
for game_num in range(game_count):
|
358 |
+
game_df = results_dict[f'game {game_num}'] # Use correct dictionary key format
|
359 |
# Remove 'game X' from playernames if present
|
360 |
clean_df = game_df.copy()
|
361 |
clean_df['playername'] = clean_df['playername'].str.split(' game ').str[0]
|
|
|
364 |
player_summary = clean_df
|
365 |
else:
|
366 |
# Add the stats to existing players
|
|
|
367 |
for col in ['Kill_Proj', 'Death_Proj', 'Assist_Proj', 'CS_Proj']:
|
368 |
player_summary[col] += clean_df[col]
|
369 |
+
# Update teamname and position if needed
|
370 |
+
player_summary['teamname'].update(clean_df['teamname'])
|
371 |
+
player_summary['position'].update(clean_df['position'])
|
372 |
+
|
373 |
player_summary = player_summary.set_index('playername')
|
374 |
|
375 |
# Create simulated percentiles
|