Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -51,8 +51,6 @@ def init_baselines():
|
|
51 |
gamelog_table = gamelog_table[['PLAYER_NAME', 'POS', 'TEAM_NAME', 'OPP_NAME', 'SEASON_ID', 'GAME_DATE', 'MATCHUP', 'MIN', 'touches', 'PTS', 'FGM', 'FGA', 'FG_PCT', 'FG3M', 'FG3A',
|
52 |
'FG3_PCT', 'FTM', 'FTA', 'FT_PCT', 'reboundChancesOffensive', 'OREB', 'reboundChancesDefensive', 'DREB', 'reboundChancesTotal', 'REB',
|
53 |
'passes', 'secondaryAssists', 'freeThrowAssists', 'assists', 'STL', 'BLK', 'TOV', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy']]
|
54 |
-
gamelog_table['spread'] = (gamelog_table.groupby(['TEAM_NAME', 'GAME_DATE'], sort=False)['PTS'].transform('sum') -
|
55 |
-
gamelog_table.groupby(['OPP_NAME', 'GAME_DATE'], sort=False)['PTS'].transform('sum'))
|
56 |
gamelog_table['assists'].replace("", 0, inplace=True)
|
57 |
gamelog_table['reboundChancesTotal'].replace("", 0, inplace=True)
|
58 |
gamelog_table['passes'].replace("", 0, inplace=True)
|
@@ -75,12 +73,14 @@ def init_baselines():
|
|
75 |
gamelog_table['FD_Fantasy_per_touch'] = gamelog_table['FD_Fantasy'] / gamelog_table['touches']
|
76 |
data_cols = gamelog_table.columns.drop(['PLAYER_NAME', 'POS', 'TEAM_NAME', 'OPP_NAME', 'SEASON_ID', 'GAME_DATE', 'MATCHUP'])
|
77 |
gamelog_table[data_cols] = gamelog_table[data_cols].apply(pd.to_numeric, errors='coerce')
|
|
|
|
|
78 |
gamelog_table['GAME_DATE'] = pd.to_datetime(gamelog_table['GAME_DATE']).dt.date
|
79 |
|
80 |
gamelog_table = gamelog_table.set_axis(['Player', 'Pos', 'Team', 'Opp', 'Season', 'Date', 'Matchup', 'Min', 'Touches', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M',
|
81 |
'FG3A', 'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
|
82 |
'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
|
83 |
-
'
|
84 |
|
85 |
worksheet = sh.worksheet('Rotations')
|
86 |
raw_display = pd.DataFrame(worksheet.get_values())
|
|
|
51 |
gamelog_table = gamelog_table[['PLAYER_NAME', 'POS', 'TEAM_NAME', 'OPP_NAME', 'SEASON_ID', 'GAME_DATE', 'MATCHUP', 'MIN', 'touches', 'PTS', 'FGM', 'FGA', 'FG_PCT', 'FG3M', 'FG3A',
|
52 |
'FG3_PCT', 'FTM', 'FTA', 'FT_PCT', 'reboundChancesOffensive', 'OREB', 'reboundChancesDefensive', 'DREB', 'reboundChancesTotal', 'REB',
|
53 |
'passes', 'secondaryAssists', 'freeThrowAssists', 'assists', 'STL', 'BLK', 'TOV', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy']]
|
|
|
|
|
54 |
gamelog_table['assists'].replace("", 0, inplace=True)
|
55 |
gamelog_table['reboundChancesTotal'].replace("", 0, inplace=True)
|
56 |
gamelog_table['passes'].replace("", 0, inplace=True)
|
|
|
73 |
gamelog_table['FD_Fantasy_per_touch'] = gamelog_table['FD_Fantasy'] / gamelog_table['touches']
|
74 |
data_cols = gamelog_table.columns.drop(['PLAYER_NAME', 'POS', 'TEAM_NAME', 'OPP_NAME', 'SEASON_ID', 'GAME_DATE', 'MATCHUP'])
|
75 |
gamelog_table[data_cols] = gamelog_table[data_cols].apply(pd.to_numeric, errors='coerce')
|
76 |
+
gamelog_table['spread'] = (gamelog_table.groupby(['TEAM_NAME', 'GAME_DATE'], sort=False)['PTS'].transform('sum') -
|
77 |
+
gamelog_table.groupby(['OPP_NAME', 'GAME_DATE'], sort=False)['PTS'].transform('sum'))
|
78 |
gamelog_table['GAME_DATE'] = pd.to_datetime(gamelog_table['GAME_DATE']).dt.date
|
79 |
|
80 |
gamelog_table = gamelog_table.set_axis(['Player', 'Pos', 'Team', 'Opp', 'Season', 'Date', 'Matchup', 'Min', 'Touches', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M',
|
81 |
'FG3A', 'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
|
82 |
'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
|
83 |
+
'Rebound%', 'Assists/Pass', 'Touch_per_min', 'Fantasy/Touch', 'FD Fantasy/Touch', 'spread'], axis=1)
|
84 |
|
85 |
worksheet = sh.worksheet('Rotations')
|
86 |
raw_display = pd.DataFrame(worksheet.get_values())
|