Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -37,7 +37,8 @@ gcservice_account = init_conn()
|
|
| 37 |
NHL_data = 'https://docs.google.com/spreadsheets/d/1NmKa-b-2D3w7rRxwMPSchh31GKfJ1XcDI2GU8rXWnHI/edit#gid=811139250'
|
| 38 |
|
| 39 |
percentages_format = {'Shots': '{:.2%}', 'HDCF': '{:.2%}', 'Goals': '{:.2%}', 'Assists': '{:.2%}', 'Blocks': '{:.2%}',
|
| 40 |
-
'L14_Shots': '{:.2%}', 'L14_HDCF': '{:.2%}', 'L14_Goals': '{:.2%}', 'L14_Assists': '{:.2%}',
|
|
|
|
| 41 |
|
| 42 |
@st.cache_resource(ttl = 599)
|
| 43 |
def init_baselines():
|
|
@@ -76,10 +77,6 @@ def init_baselines():
|
|
| 76 |
# raw_display = raw_display[raw_display['Line'] != ""]
|
| 77 |
overall_ms = raw_display[['Line', 'SK1', 'SK2', 'SK3', 'Cost', 'Team Total', 'Shots', 'HDCF', 'Goals', 'Assists', 'Blocks',
|
| 78 |
'L14_Shots', 'L14_HDCF', 'L14_Goals', 'L14_Assists', 'L14_Blocks']]
|
| 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()
|
|
@@ -87,7 +84,10 @@ def init_baselines():
|
|
| 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 |
|
| 93 |
def convert_df_to_csv(df):
|
|
|
|
| 37 |
NHL_data = 'https://docs.google.com/spreadsheets/d/1NmKa-b-2D3w7rRxwMPSchh31GKfJ1XcDI2GU8rXWnHI/edit#gid=811139250'
|
| 38 |
|
| 39 |
percentages_format = {'Shots': '{:.2%}', 'HDCF': '{:.2%}', 'Goals': '{:.2%}', 'Assists': '{:.2%}', 'Blocks': '{:.2%}',
|
| 40 |
+
'L14_Shots': '{:.2%}', 'L14_HDCF': '{:.2%}', 'L14_Goals': '{:.2%}', 'L14_Assists': '{:.2%}',
|
| 41 |
+
'L14_Blocks': '{:.2%}', 'Max Goal%': '{:.2%}'}
|
| 42 |
|
| 43 |
@st.cache_resource(ttl = 599)
|
| 44 |
def init_baselines():
|
|
|
|
| 77 |
# raw_display = raw_display[raw_display['Line'] != ""]
|
| 78 |
overall_ms = raw_display[['Line', 'SK1', 'SK2', 'SK3', 'Cost', 'Team Total', 'Shots', 'HDCF', 'Goals', 'Assists', 'Blocks',
|
| 79 |
'L14_Shots', 'L14_HDCF', 'L14_Goals', 'L14_Assists', 'L14_Blocks']]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
for team in team_list:
|
| 81 |
table_parsed = overall_ms[overall_ms['Line'].str.contains('|'.join(team))]
|
| 82 |
table_parsed['Max Goal%'] = table_parsed['Goals'].max()
|
|
|
|
| 84 |
parse_hold = pd.concat([parse_hold, table_parsed])
|
| 85 |
|
| 86 |
overall_ms = parse_hold
|
| 87 |
+
data_cols = overall_ms.columns.drop(['Line', 'SK1', 'SK2', 'SK3'])
|
| 88 |
+
overall_ms[data_cols] = overall_ms[data_cols].apply(pd.to_numeric, errors='coerce')
|
| 89 |
+
overall_ms = overall_ms.sort_values(by='Shots', ascending=False)
|
| 90 |
+
|
| 91 |
return matchups, overall_ms, team_frame, team_list, team_dict
|
| 92 |
|
| 93 |
def convert_df_to_csv(df):
|