Spaces:
Running
Running
James McCool
commited on
Commit
·
64f88b0
1
Parent(s):
4b70cc2
Refactor init_team_data function in app.py to improve variable handling and clarity. Introduced a count_var to streamline the distinction between raw_display and raw_opponent data tables, enhancing the readability of statistical calculations for kills, deaths, assists, and total CS. This change contributes to better organization and understanding of team performance metrics.
Browse files
app.py
CHANGED
@@ -117,6 +117,7 @@ def init_team_data(team, opponent, win_loss, kill_prediction, death_prediction,
|
|
117 |
raw_opponent = pd.DataFrame(list(cursor))
|
118 |
|
119 |
for tables in [raw_display, raw_opponent]:
|
|
|
120 |
calc_columns = ['kills', 'deaths', 'assists', 'total_cs']
|
121 |
league_win_stats = {}
|
122 |
league_loss_stats = {}
|
@@ -263,7 +264,7 @@ def init_team_data(team, opponent, win_loss, kill_prediction, death_prediction,
|
|
263 |
tables['playername_avg_assist_share_loss'] = tables['playername_avg_assists_loss'] / tables['teamname_avg_kills_loss']
|
264 |
tables['playername_avg_cs_share_loss'] = tables['playername_avg_total_cs_loss'] / tables['teamname_avg_total_cs_loss']
|
265 |
|
266 |
-
if
|
267 |
player_tables = tables
|
268 |
else:
|
269 |
opp_tables = tables
|
|
|
117 |
raw_opponent = pd.DataFrame(list(cursor))
|
118 |
|
119 |
for tables in [raw_display, raw_opponent]:
|
120 |
+
count_var = 'raw_display' if tables == raw_display else 'raw_opponent'
|
121 |
calc_columns = ['kills', 'deaths', 'assists', 'total_cs']
|
122 |
league_win_stats = {}
|
123 |
league_loss_stats = {}
|
|
|
264 |
tables['playername_avg_assist_share_loss'] = tables['playername_avg_assists_loss'] / tables['teamname_avg_kills_loss']
|
265 |
tables['playername_avg_cs_share_loss'] = tables['playername_avg_total_cs_loss'] / tables['teamname_avg_total_cs_loss']
|
266 |
|
267 |
+
if count_var == 'raw_display':
|
268 |
player_tables = tables
|
269 |
else:
|
270 |
opp_tables = tables
|