Spaces:
Running
Running
James McCool
commited on
Commit
·
ec25780
1
Parent(s):
58e1c0d
Adjusted gamelog column names
Browse files
app.py
CHANGED
@@ -46,21 +46,17 @@ def init_baselines():
|
|
46 |
raw_display = raw_display[1:]
|
47 |
raw_display = raw_display.reset_index(drop=True)
|
48 |
gamelog_table = raw_display[raw_display['Player'] != ""]
|
49 |
-
gamelog_table = gamelog_table[['Player', 'Team', 'Position', 'Date', 'TOI', 'Goals', '
|
|
|
|
|
|
|
|
|
50 |
'Shots', 'SH%', 'ixG', 'iCF', 'iFF', 'iSCF', 'iHDCF', 'Rush Attempts', 'Rebounds Created', 'PIM', 'Total Penalties', 'Minor',
|
51 |
'Major', 'Penalties Drawn', 'Giveaways', 'Takeaways', 'Hits', 'Hits Taken', 'Shots Blocked', 'Faceoffs Won',
|
52 |
-
'Faceoffs Lost', 'Faceoffs %']
|
53 |
data_cols = gamelog_table.columns.drop(['Player', 'Team', 'Position', 'Date'])
|
54 |
gamelog_table[data_cols] = gamelog_table[data_cols].apply(pd.to_numeric, errors='coerce')
|
55 |
gamelog_table['Date'] = pd.to_datetime(gamelog_table['Date']).dt.date
|
56 |
-
# gamelog_table['Shots'].replace("", 0, inplace=True)
|
57 |
-
# gamelog_table['Shots Blocked'].replace("", 0, inplace=True)
|
58 |
-
# gamelog_table['Goals'].replace("", 0, inplace=True)
|
59 |
-
# gamelog_table['Total Points'].replace("", 0, inplace=True)
|
60 |
-
# gamelog_table['Shots'] = gamelog_table['Shots'].astype(int)
|
61 |
-
# gamelog_table['Shots Blocked'] = gamelog_table['Shots Blocked'].astype(int)
|
62 |
-
# gamelog_table['Goals'] = gamelog_table['Goals'].astype(int)
|
63 |
-
# gamelog_table['Total Points'] = gamelog_table['Total Points'].astype(int)
|
64 |
gamelog_table['dk_shots_bonus'] = np.where((gamelog_table['Shots'] >= 5), 1, 0)
|
65 |
gamelog_table['dk_blocks_bonus'] = np.where((gamelog_table['Shots Blocked'] >= 3), 1, 0)
|
66 |
gamelog_table['dk_goals_bonus'] = np.where((gamelog_table['Goals'] >= 3), 1, 0)
|
|
|
46 |
raw_display = raw_display[1:]
|
47 |
raw_display = raw_display.reset_index(drop=True)
|
48 |
gamelog_table = raw_display[raw_display['Player'] != ""]
|
49 |
+
gamelog_table = gamelog_table[['Player', 'Team', 'Position', 'Date', 'TOI', 'Goals', 'TotalAssists', 'FirstAssists', 'SecondAssists', 'TotalPoints', 'IPP',
|
50 |
+
'Shots', 'SH%', 'ixG', 'iCF', 'iFF', 'iSCF', 'iHDCF', 'RushAttempts', 'ReboundsCreated', 'PIM', 'TotalPenalties', 'Minor',
|
51 |
+
'Major', 'PenaltiesDrawn', 'Giveaways', 'Takeaways', 'Hits', 'HitsTaken', 'ShotsBlocked', 'FaceoffsWon',
|
52 |
+
'FaceoffsLost', 'Faceoffs%']]
|
53 |
+
gamelog_table = gamelog_table.set_axis(['Player', 'Team', 'Position', 'Date', 'TOI', 'Goals', 'Total Assists', 'First Assists', 'Second Assists', 'Total Points', 'IPP',
|
54 |
'Shots', 'SH%', 'ixG', 'iCF', 'iFF', 'iSCF', 'iHDCF', 'Rush Attempts', 'Rebounds Created', 'PIM', 'Total Penalties', 'Minor',
|
55 |
'Major', 'Penalties Drawn', 'Giveaways', 'Takeaways', 'Hits', 'Hits Taken', 'Shots Blocked', 'Faceoffs Won',
|
56 |
+
'Faceoffs Lost', 'Faceoffs %'], axis=1)
|
57 |
data_cols = gamelog_table.columns.drop(['Player', 'Team', 'Position', 'Date'])
|
58 |
gamelog_table[data_cols] = gamelog_table[data_cols].apply(pd.to_numeric, errors='coerce')
|
59 |
gamelog_table['Date'] = pd.to_datetime(gamelog_table['Date']).dt.date
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
gamelog_table['dk_shots_bonus'] = np.where((gamelog_table['Shots'] >= 5), 1, 0)
|
61 |
gamelog_table['dk_blocks_bonus'] = np.where((gamelog_table['Shots Blocked'] >= 3), 1, 0)
|
62 |
gamelog_table['dk_goals_bonus'] = np.where((gamelog_table['Goals'] >= 3), 1, 0)
|