James McCool commited on
Commit
2b6c4f2
·
1 Parent(s): 1b9d1b4

Refactor team data retrieval in init_player_data function to use 'teamname' for filtering. Removed unnecessary st.write() calls for player and team data display to streamline output. This change enhances data integrity and improves the clarity of the application during simulations.

Browse files
Files changed (1) hide show
  1. app.py +2 -5
app.py CHANGED
@@ -413,8 +413,8 @@ def init_player_data(game_count, players, opponent, win_loss_settings, kill_pred
413
  for stats in calc_columns:
414
  playername_win_stats[stats] = tables[tables['result'] == 1].groupby(['playername'])[stats].mean().to_dict()
415
  playername_loss_stats[stats] = tables[tables['result'] == 0].groupby(['playername'])[stats].mean().to_dict()
416
- teamname_win_stats[stats] = tables[(tables['result'] == 1) & (tables['position'] == 'team')].groupby(['teamname'])[stats].mean().to_dict()
417
- teamname_loss_stats[stats] = tables[(tables['result'] == 0) & (tables['position'] == 'team')].groupby(['teamname'])[stats].mean().to_dict()
418
 
419
  for stat in calc_columns:
420
 
@@ -451,7 +451,6 @@ def init_player_data(game_count, players, opponent, win_loss_settings, kill_pred
451
  tables['playername_avg_assist_share_loss'] = tables['playername_avg_assists_loss'] / tables['teamname_avg_kills_loss']
452
  tables['playername_avg_cs_share_loss'] = tables['playername_avg_total_cs_loss'] / tables['teamname_avg_total_cs_loss']
453
  player_tables = tables
454
- st.write(player_tables)
455
 
456
  else:
457
 
@@ -603,10 +602,8 @@ if st.button("Load/Reset Data", key='reset1'):
603
  if st.button("Run"):
604
  if data_type == "Team":
605
  team_data, opp_boost, results_dict = init_team_data(game_count, selected_team, selected_opponent, win_loss_settings, kill_predictions, death_predictions, start_date, end_date)
606
- st.write(team_data)
607
  else:
608
  team_data, opp_boost, results_dict = init_player_data(game_count, selected_players, selected_opponent, win_loss_settings, kill_predictions, death_predictions, start_date, end_date)
609
- st.write(team_data)
610
 
611
  player_summary = pd.DataFrame()
612
  for game_num in range(game_count):
 
413
  for stats in calc_columns:
414
  playername_win_stats[stats] = tables[tables['result'] == 1].groupby(['playername'])[stats].mean().to_dict()
415
  playername_loss_stats[stats] = tables[tables['result'] == 0].groupby(['playername'])[stats].mean().to_dict()
416
+ teamname_win_stats[stats] = tables[(tables['result'] == 1) & (tables['teamname'] == 'team')].groupby(['teamname'])[stats].mean().to_dict()
417
+ teamname_loss_stats[stats] = tables[(tables['result'] == 0) & (tables['teamname'] == 'team')].groupby(['teamname'])[stats].mean().to_dict()
418
 
419
  for stat in calc_columns:
420
 
 
451
  tables['playername_avg_assist_share_loss'] = tables['playername_avg_assists_loss'] / tables['teamname_avg_kills_loss']
452
  tables['playername_avg_cs_share_loss'] = tables['playername_avg_total_cs_loss'] / tables['teamname_avg_total_cs_loss']
453
  player_tables = tables
 
454
 
455
  else:
456
 
 
602
  if st.button("Run"):
603
  if data_type == "Team":
604
  team_data, opp_boost, results_dict = init_team_data(game_count, selected_team, selected_opponent, win_loss_settings, kill_predictions, death_predictions, start_date, end_date)
 
605
  else:
606
  team_data, opp_boost, results_dict = init_player_data(game_count, selected_players, selected_opponent, win_loss_settings, kill_predictions, death_predictions, start_date, end_date)
 
607
 
608
  player_summary = pd.DataFrame()
609
  for game_num in range(game_count):