Multichem commited on
Commit
dd81fad
·
1 Parent(s): 57ed052

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -5
app.py CHANGED
@@ -171,8 +171,14 @@ def convert_df_to_csv(df):
171
  return df.to_csv().encode('utf-8')
172
 
173
  gamelog_table = init_baselines()
174
- data_cols = gamelog_table.columns.drop(['Player', 'Team', 'Position', 'Date', 'TOI'])
175
- season_data_cols = ['TOI', 'Goals', 'Total Assists', 'First Assists', 'Second Assists', 'Total Points',
 
 
 
 
 
 
176
  'IPP', 'Shots', 'ixG', 'iCF', 'iFF', 'iSCF', 'iHDCF', 'Rush Attempts', 'Rebounds Created', 'PIM', 'Total Penalties',
177
  'Minor', 'Major', 'Penalties Drawn', 'Giveaways', 'Takeaways', 'Hits', 'Hits Taken', 'Shots Blocked', 'Faceoffs Won',
178
  'Faceoffs Lost', 'dk_shots_bonus', 'dk_blocks_bonus', 'dk_goals_bonus', 'dk_points_bonus',
@@ -191,7 +197,18 @@ with tab1:
191
  if st.button("Reset Data", key='reset1'):
192
  st.cache_data.clear()
193
  gamelog_table = init_baselines()
194
- data_cols = gamelog_table.columns.drop(['Player', 'Team', 'Position', 'Date', 'TOI'])
 
 
 
 
 
 
 
 
 
 
 
195
  indv_teams = gamelog_table.drop_duplicates(subset='Team')
196
  total_teams = indv_teams.Team.values.tolist()
197
  indv_players = gamelog_table.drop_duplicates(subset='Player')
@@ -231,7 +248,9 @@ with tab1:
231
  with col2:
232
  if split_var1 == 'Season Logs':
233
  choose_cols = st.container()
234
- choose_cols.multiselect('Which stats would you like to view?', options = season_data_cols, default = season_data_cols, key='col_display')
 
 
235
  display = st.container()
236
  gamelog_table = gamelog_table[gamelog_table['Date'] >= low_date]
237
  gamelog_table = gamelog_table[gamelog_table['Date'] <= high_date]
@@ -241,7 +260,8 @@ with tab1:
241
  gamelog_table = gamelog_table[gamelog_table['Player'].isin(player_var1)]
242
  season_long_table = seasonlong_build(gamelog_table)
243
  season_long_table = season_long_table.set_index('Player')
244
- display.dataframe(season_long_table.style.format(precision=2), height=750, use_container_width = True)
 
245
 
246
  elif split_var1 == 'Gamelogs':
247
  choose_cols = st.container()
 
171
  return df.to_csv().encode('utf-8')
172
 
173
  gamelog_table = init_baselines()
174
+ basic_cols = ['Player', 'Team', 'Position', 'Date', 'TOI']
175
+ basic_season_cols = ['Player', 'Team', 'Position', 'TOI']
176
+ data_cols = ['Goals', 'Total Assists', 'First Assists', 'Second Assists', 'Total Points', 'IPP',
177
+ 'Shots', 'Shots%', 'ixG', 'iCF', 'iFF', 'iSCF', 'iHDCF', 'Rush Attempts', 'Rebounds Created', 'PIM', 'Total Penalties', 'Minor',
178
+ 'Major', 'Penalties Drawn', 'Giveaways', 'Takeaways', 'Hits', 'Hits Taken', 'Shots Blocked', 'Faceoffs Won',
179
+ 'Faceoffs Lost', 'Faceoffs%', 'dk_shots_bonus', 'dk_blocks_bonus', 'dk_goals_bonus', 'dk_points_bonus',
180
+ 'dk_fantasy', 'fd_fantasy']
181
+ season_data_cols = ['Goals', 'Total Assists', 'First Assists', 'Second Assists', 'Total Points',
182
  'IPP', 'Shots', 'ixG', 'iCF', 'iFF', 'iSCF', 'iHDCF', 'Rush Attempts', 'Rebounds Created', 'PIM', 'Total Penalties',
183
  'Minor', 'Major', 'Penalties Drawn', 'Giveaways', 'Takeaways', 'Hits', 'Hits Taken', 'Shots Blocked', 'Faceoffs Won',
184
  'Faceoffs Lost', 'dk_shots_bonus', 'dk_blocks_bonus', 'dk_goals_bonus', 'dk_points_bonus',
 
197
  if st.button("Reset Data", key='reset1'):
198
  st.cache_data.clear()
199
  gamelog_table = init_baselines()
200
+ basic_cols = ['Player', 'Team', 'Position', 'Date', 'TOI']
201
+ basic_season_cols = ['Player', 'Team', 'Position', 'TOI']
202
+ data_cols = ['Goals', 'Total Assists', 'First Assists', 'Second Assists', 'Total Points', 'IPP',
203
+ 'Shots', 'Shots%', 'ixG', 'iCF', 'iFF', 'iSCF', 'iHDCF', 'Rush Attempts', 'Rebounds Created', 'PIM', 'Total Penalties', 'Minor',
204
+ 'Major', 'Penalties Drawn', 'Giveaways', 'Takeaways', 'Hits', 'Hits Taken', 'Shots Blocked', 'Faceoffs Won',
205
+ 'Faceoffs Lost', 'Faceoffs%', 'dk_shots_bonus', 'dk_blocks_bonus', 'dk_goals_bonus', 'dk_points_bonus',
206
+ 'dk_fantasy', 'fd_fantasy']
207
+ season_data_cols = ['Goals', 'Total Assists', 'First Assists', 'Second Assists', 'Total Points',
208
+ 'IPP', 'Shots', 'ixG', 'iCF', 'iFF', 'iSCF', 'iHDCF', 'Rush Attempts', 'Rebounds Created', 'PIM', 'Total Penalties',
209
+ 'Minor', 'Major', 'Penalties Drawn', 'Giveaways', 'Takeaways', 'Hits', 'Hits Taken', 'Shots Blocked', 'Faceoffs Won',
210
+ 'Faceoffs Lost', 'dk_shots_bonus', 'dk_blocks_bonus', 'dk_goals_bonus', 'dk_points_bonus',
211
+ 'dk_fantasy', 'fd_fantasy']
212
  indv_teams = gamelog_table.drop_duplicates(subset='Team')
213
  total_teams = indv_teams.Team.values.tolist()
214
  indv_players = gamelog_table.drop_duplicates(subset='Player')
 
248
  with col2:
249
  if split_var1 == 'Season Logs':
250
  choose_cols = st.container()
251
+ with choose_cols:
252
+ choose_disp = st.multiselect('Which stats would you like to view?', options = season_data_cols, default = season_data_cols, key='col_display')
253
+ disp_stats = basic_cols + choose_disp
254
  display = st.container()
255
  gamelog_table = gamelog_table[gamelog_table['Date'] >= low_date]
256
  gamelog_table = gamelog_table[gamelog_table['Date'] <= high_date]
 
260
  gamelog_table = gamelog_table[gamelog_table['Player'].isin(player_var1)]
261
  season_long_table = seasonlong_build(gamelog_table)
262
  season_long_table = season_long_table.set_index('Player')
263
+ season_long_table_disp = season_long_table[[disp_stats]]
264
+ display.dataframe(season_long_table_disp.style.format(precision=2), height=750, use_container_width = True)
265
 
266
  elif split_var1 == 'Gamelogs':
267
  choose_cols = st.container()