Spaces:
Running
Running
James McCool
commited on
Commit
·
34b8899
1
Parent(s):
a9ee089
Refactor init_team_data and init_player_data functions in app.py to accept game_count as a parameter. This change improves function clarity and ensures consistent handling of game count across team and player data initialization. Updated function calls in the simulation logic to reflect this modification.
Browse files
app.py
CHANGED
@@ -164,8 +164,8 @@ def simulate_stats(row, num_sims=1000):
|
|
164 |
return pd.Series(results)
|
165 |
|
166 |
@st.cache_data(ttl = 60)
|
167 |
-
def init_team_data(team, opponent, win_loss_settings, kill_predictions, death_predictions, start_date, end_date):
|
168 |
-
game_count =
|
169 |
overall_team_data = pd.DataFrame(columns = ['playername', 'teamname', 'position', 'Kill_Proj', 'Death_Proj', 'Assist_Proj', 'CS_Proj'])
|
170 |
# Convert date objects to datetime strings in the correct format
|
171 |
start_datetime = datetime.combine(start_date, datetime.min.time()).strftime("%Y-%m-%d %H:%M:%S")
|
@@ -376,8 +376,8 @@ def init_team_data(team, opponent, win_loss_settings, kill_predictions, death_pr
|
|
376 |
return overall_team_data.dropna().set_index('playername'), opp_boosts, results_dict
|
377 |
|
378 |
@st.cache_data(ttl = 60)
|
379 |
-
def init_player_data(players, opponent, win_loss_settings, kill_predictions, death_predictions, start_date, end_date):
|
380 |
-
game_count =
|
381 |
overall_team_data = pd.DataFrame(columns = ['playername', 'teamname', 'position', 'Kill_Proj', 'Death_Proj', 'Assist_Proj', 'CS_Proj'])
|
382 |
# Convert date objects to datetime strings in the correct format
|
383 |
start_datetime = datetime.combine(start_date, datetime.min.time()).strftime("%Y-%m-%d %H:%M:%S")
|
@@ -592,9 +592,9 @@ if st.button("Load/Reset Data", key='reset1'):
|
|
592 |
|
593 |
if st.button("Run"):
|
594 |
if data_type == "Team":
|
595 |
-
team_data, opp_boost, results_dict = init_team_data(selected_team, selected_opponent, win_loss_settings, kill_predictions, death_predictions, start_date, end_date)
|
596 |
else:
|
597 |
-
team_data, opp_boost, results_dict = init_player_data(selected_players, selected_opponent, win_loss_settings, kill_predictions, death_predictions, start_date, end_date)
|
598 |
|
599 |
player_summary = pd.DataFrame()
|
600 |
for game_num in range(game_count):
|
|
|
164 |
return pd.Series(results)
|
165 |
|
166 |
@st.cache_data(ttl = 60)
|
167 |
+
def init_team_data(game_count, team, opponent, win_loss_settings, kill_predictions, death_predictions, start_date, end_date):
|
168 |
+
game_count = game_count
|
169 |
overall_team_data = pd.DataFrame(columns = ['playername', 'teamname', 'position', 'Kill_Proj', 'Death_Proj', 'Assist_Proj', 'CS_Proj'])
|
170 |
# Convert date objects to datetime strings in the correct format
|
171 |
start_datetime = datetime.combine(start_date, datetime.min.time()).strftime("%Y-%m-%d %H:%M:%S")
|
|
|
376 |
return overall_team_data.dropna().set_index('playername'), opp_boosts, results_dict
|
377 |
|
378 |
@st.cache_data(ttl = 60)
|
379 |
+
def init_player_data(game_count, players, opponent, win_loss_settings, kill_predictions, death_predictions, start_date, end_date):
|
380 |
+
game_count = game_count
|
381 |
overall_team_data = pd.DataFrame(columns = ['playername', 'teamname', 'position', 'Kill_Proj', 'Death_Proj', 'Assist_Proj', 'CS_Proj'])
|
382 |
# Convert date objects to datetime strings in the correct format
|
383 |
start_datetime = datetime.combine(start_date, datetime.min.time()).strftime("%Y-%m-%d %H:%M:%S")
|
|
|
592 |
|
593 |
if st.button("Run"):
|
594 |
if data_type == "Team":
|
595 |
+
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)
|
596 |
else:
|
597 |
+
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)
|
598 |
|
599 |
player_summary = pd.DataFrame()
|
600 |
for game_num in range(game_count):
|