James McCool commited on
Commit
e855530
·
1 Parent(s): e568f6d

Refactor overall_team_data structure in app.py by removing the 'game' column and renaming it to 'playername' for improved clarity. This change streamlines the data representation in the init_team_data function, enhancing the organization of player statistics and maintaining focus on key performance metrics.

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -151,7 +151,7 @@ def simulate_stats(row, num_sims=1000):
151
  @st.cache_data(ttl = 60)
152
  def init_team_data(team, opponent, win_loss_settings, kill_predictions, death_predictions, start_date, end_date):
153
  game_count = len(kill_predictions)
154
- overall_team_data = pd.DataFrame(columns = ['playername', 'teamname', 'position', 'league', 'Opponent', 'result', 'Kill_Proj', 'Death_Proj', 'Assist_Proj', 'CS_Proj', 'game'])
155
  # Convert date objects to datetime strings in the correct format
156
  start_datetime = datetime.combine(start_date, datetime.min.time()).strftime("%Y-%m-%d %H:%M:%S")
157
  end_datetime = datetime.combine(end_date, datetime.max.time()).strftime("%Y-%m-%d %H:%M:%S")
@@ -340,7 +340,7 @@ def init_team_data(team, opponent, win_loss_settings, kill_predictions, death_pr
340
  team_data['Assist_Proj'] = team_data.apply(lambda row: row['lAssist%'] * opp_pos_assists_boost_loss.get(row['position'], 1), axis=1)
341
  team_data['CS_Proj'] = team_data.apply(lambda row: row['lCS'] * opp_pos_cs_boost_loss.get(row['position'], 1), axis=1)
342
  team_data = team_data[['playername', 'teamname', 'position', 'Kill_Proj', 'Death_Proj', 'Assist_Proj', 'CS_Proj']]
343
- team_data['game'] = f'game {game + 1}'
344
 
345
  overall_team_data = pd.concat([overall_team_data, team_data])
346
 
 
151
  @st.cache_data(ttl = 60)
152
  def init_team_data(team, opponent, win_loss_settings, kill_predictions, death_predictions, start_date, end_date):
153
  game_count = len(kill_predictions)
154
+ overall_team_data = pd.DataFrame(columns = ['playername', 'teamname', 'position', 'league', 'Opponent', 'result', 'Kill_Proj', 'Death_Proj', 'Assist_Proj', 'CS_Proj'])
155
  # Convert date objects to datetime strings in the correct format
156
  start_datetime = datetime.combine(start_date, datetime.min.time()).strftime("%Y-%m-%d %H:%M:%S")
157
  end_datetime = datetime.combine(end_date, datetime.max.time()).strftime("%Y-%m-%d %H:%M:%S")
 
340
  team_data['Assist_Proj'] = team_data.apply(lambda row: row['lAssist%'] * opp_pos_assists_boost_loss.get(row['position'], 1), axis=1)
341
  team_data['CS_Proj'] = team_data.apply(lambda row: row['lCS'] * opp_pos_cs_boost_loss.get(row['position'], 1), axis=1)
342
  team_data = team_data[['playername', 'teamname', 'position', 'Kill_Proj', 'Death_Proj', 'Assist_Proj', 'CS_Proj']]
343
+ team_data['playername'] = f'playername {game + 1}'
344
 
345
  overall_team_data = pd.concat([overall_team_data, team_data])
346