Multichem commited on
Commit
45429ae
·
1 Parent(s): c6851be

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -75,7 +75,7 @@ def init_baselines():
75
  gamelog_table[data_cols] = gamelog_table[data_cols].apply(pd.to_numeric, errors='coerce')
76
  gamelog_table['team_score'] = gamelog_table.groupby(['TEAM_NAME', 'GAME_ID'], sort=False)['PTS'].transform('sum')
77
  gamelog_table['opp_score'] = gamelog_table.groupby(['GAME_ID'], sort=False)['PTS'].transform('sum') - gamelog_table['team_score']
78
- gamelog_table['spread'] = gamelog_table['opp_score'] - gamelog_table['team_score']
79
  gamelog_table['GAME_DATE'] = pd.to_datetime(gamelog_table['GAME_DATE']).dt.date
80
 
81
  gamelog_table = gamelog_table.set_axis(['Player', 'Pos', 'game_id', 'Team', 'Opp', 'Season', 'Date', 'Matchup', 'Min', 'Touches', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M',
@@ -268,7 +268,7 @@ with tab1:
268
  elif split_var4 == 'All':
269
  player_var1 = total_players
270
 
271
- spread_var1 = st.slider("Is there a certain spread range you want to view?", -100, 100, (-100, 100), key='spread_var1')
272
 
273
  min_var1 = st.slider("Is there a certain minutes range you want to view?", 0, 60, (0, 60), key='min_var1')
274
 
@@ -386,7 +386,7 @@ with tab2:
386
  low_date_t2 = gamelog_table['Date'].min()
387
  high_date_t2 = gamelog_table['Date'].max()
388
 
389
- spread_var1_t2 = st.slider("Is there a certain spread range you want to view?", -100, 100, (-100, 100), key='spread_var1_t2')
390
 
391
  min_var1_t2 = st.slider("Is there a certain minutes range you want to view?", 0, 60, (0, 60), key='min_var1_t2')
392
 
@@ -470,7 +470,7 @@ with tab3:
470
  low_date3 = gamelog_table['Date'].min()
471
  high_date3 = gamelog_table['Date'].max()
472
 
473
- spread_var3 = st.slider("Is there a certain spread range you want to view?", -100, 100, (-100, 100), key='spread_var3')
474
 
475
  min_var3 = st.slider("Is there a certain minutes range you want to view?", 0, 60, (0, 60), key='min_var3')
476
 
 
75
  gamelog_table[data_cols] = gamelog_table[data_cols].apply(pd.to_numeric, errors='coerce')
76
  gamelog_table['team_score'] = gamelog_table.groupby(['TEAM_NAME', 'GAME_ID'], sort=False)['PTS'].transform('sum')
77
  gamelog_table['opp_score'] = gamelog_table.groupby(['GAME_ID'], sort=False)['PTS'].transform('sum') - gamelog_table['team_score']
78
+ gamelog_table['spread'] = (gamelog_table['opp_score'] - gamelog_table['team_score']).abs()
79
  gamelog_table['GAME_DATE'] = pd.to_datetime(gamelog_table['GAME_DATE']).dt.date
80
 
81
  gamelog_table = gamelog_table.set_axis(['Player', 'Pos', 'game_id', 'Team', 'Opp', 'Season', 'Date', 'Matchup', 'Min', 'Touches', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M',
 
268
  elif split_var4 == 'All':
269
  player_var1 = total_players
270
 
271
+ spread_var1 = st.slider("Is there a certain spread range you want to view?", 0, 100, (0, 100), key='spread_var1')
272
 
273
  min_var1 = st.slider("Is there a certain minutes range you want to view?", 0, 60, (0, 60), key='min_var1')
274
 
 
386
  low_date_t2 = gamelog_table['Date'].min()
387
  high_date_t2 = gamelog_table['Date'].max()
388
 
389
+ spread_var1_t2 = st.slider("Is there a certain spread range you want to view?", 0, 100, (0, 100), key='spread_var1_t2')
390
 
391
  min_var1_t2 = st.slider("Is there a certain minutes range you want to view?", 0, 60, (0, 60), key='min_var1_t2')
392
 
 
470
  low_date3 = gamelog_table['Date'].min()
471
  high_date3 = gamelog_table['Date'].max()
472
 
473
+ spread_var3 = st.slider("Is there a certain spread range you want to view?", 0, 100, (0, 100), key='spread_var3')
474
 
475
  min_var3 = st.slider("Is there a certain minutes range you want to view?", 0, 60, (0, 60), key='min_var3')
476