Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -41,6 +41,9 @@ percentages_format = {'Shots': '{:.2%}', 'HDCF': '{:.2%}', 'Goals': '{:.2%}', 'A
|
|
| 41 |
|
| 42 |
@st.cache_resource(ttl = 599)
|
| 43 |
def init_baselines():
|
|
|
|
|
|
|
|
|
|
| 44 |
sh = gcservice_account.open_by_url(NHL_data)
|
| 45 |
|
| 46 |
worksheet = sh.worksheet('Player_Level_ROO')
|
|
@@ -76,6 +79,14 @@ def init_baselines():
|
|
| 76 |
data_cols = overall_ms.columns.drop(['Line', 'SK1', 'SK2', 'SK3'])
|
| 77 |
overall_ms[data_cols] = overall_ms[data_cols].apply(pd.to_numeric, errors='coerce')
|
| 78 |
overall_ms = overall_ms.sort_values(by='Shots', ascending=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
return matchups, overall_ms, team_frame, team_list, team_dict
|
| 81 |
|
|
|
|
| 41 |
|
| 42 |
@st.cache_resource(ttl = 599)
|
| 43 |
def init_baselines():
|
| 44 |
+
parse_hold = pd.DataFrame(columns=['Line', 'SK1', 'SK2', 'SK3', 'Cost', 'Team Total', 'Shots', 'HDCF', 'Goals', 'Assists', 'Blocks',
|
| 45 |
+
'L14_Shots', 'L14_HDCF', 'L14_Goals', 'L14_Assists', 'L14_Blocks', 'Max Goal%'])
|
| 46 |
+
|
| 47 |
sh = gcservice_account.open_by_url(NHL_data)
|
| 48 |
|
| 49 |
worksheet = sh.worksheet('Player_Level_ROO')
|
|
|
|
| 79 |
data_cols = overall_ms.columns.drop(['Line', 'SK1', 'SK2', 'SK3'])
|
| 80 |
overall_ms[data_cols] = overall_ms[data_cols].apply(pd.to_numeric, errors='coerce')
|
| 81 |
overall_ms = overall_ms.sort_values(by='Shots', ascending=False)
|
| 82 |
+
|
| 83 |
+
for team in team_list:
|
| 84 |
+
table_parsed = overall_ms[overall_ms['Line'].str.contains('|'.join(team))]
|
| 85 |
+
table_parsed['Max Goal%'] = table_parsed['Goals'].max()
|
| 86 |
+
|
| 87 |
+
parse_hold = pd.concat([parse_hold, table_parsed])
|
| 88 |
+
|
| 89 |
+
overall_ms = parse_hold
|
| 90 |
|
| 91 |
return matchups, overall_ms, team_frame, team_list, team_dict
|
| 92 |
|