James McCool commited on
Commit
cfb234d
·
1 Parent(s): b2155d1

I think this will work. I'm trying to return just the top 10 rows of stint_stats and then write out stint_id_head.

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +10 -9
src/streamlit_app.py CHANGED
@@ -211,7 +211,7 @@ def init_baselines(data_req: str):
211
  except Exception:
212
  pass # Silently continue if stint stats unavailable
213
 
214
- return gamelog_table, game_rot, timestamp
215
 
216
  @st.cache_data(show_spinner=False)
217
  def seasonlong_build(data_sample):
@@ -329,7 +329,7 @@ if selected_tab == 'Gamelogs':
329
  with col1:
330
  if st.button("Reset Data", key='reset1'):
331
  st.cache_data.clear()
332
- gamelog_table, game_rot, timestamp = init_baselines('gamelogs')
333
  basic_cols = ['Player', 'Pos', 'Team', 'Opp', 'Season', 'Date', 'Matchup', 'Min']
334
  basic_season_cols = ['Pos', 'Team', 'Min']
335
  data_cols = ['team_score', 'opp_score', 'spread', 'Touches', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M',
@@ -348,7 +348,7 @@ if selected_tab == 'Gamelogs':
348
  total_players = indv_players.Player.values.tolist()
349
  total_dates = gamelog_table.Date.values.tolist()
350
 
351
- gamelog_table, game_rot, timestamp = init_baselines('gamelogs')
352
  indv_teams = gamelog_table.drop_duplicates(subset='Team')
353
  total_teams = indv_teams.Team.values.tolist()
354
  indv_players = gamelog_table.drop_duplicates(subset='Player')
@@ -460,7 +460,7 @@ if selected_tab == 'Correlation Matrix':
460
  with col1:
461
  if st.button("Reset Data", key='reset2'):
462
  st.cache_data.clear()
463
- gamelog_table, game_rot, timestamp = init_baselines('gamelogs')
464
  basic_cols = ['Player', 'Pos', 'Team', 'Opp', 'Season', 'Date', 'Matchup', 'Min']
465
  basic_season_cols = ['Pos', 'Team', 'Min']
466
  data_cols = ['team_score', 'opp_score', 'spread', 'Touches', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M',
@@ -479,7 +479,7 @@ if selected_tab == 'Correlation Matrix':
479
  total_players = indv_players.Player.values.tolist()
480
  total_dates = gamelog_table.Date.values.tolist()
481
 
482
- gamelog_table, game_rot, timestamp = init_baselines('gamelogs')
483
  indv_teams = gamelog_table.drop_duplicates(subset='Team')
484
  total_teams = indv_teams.Team.values.tolist()
485
  indv_players = gamelog_table.drop_duplicates(subset='Player')
@@ -557,7 +557,7 @@ if selected_tab == 'Position vs. Opp':
557
  with col1:
558
  if st.button("Reset Data", key='reset3'):
559
  st.cache_data.clear()
560
- gamelog_table, game_rot, timestamp = init_baselines('gamelogs')
561
  basic_cols = ['Player', 'Pos', 'Team', 'Opp', 'Season', 'Date', 'Matchup', 'Min']
562
  basic_season_cols = ['Pos', 'Team', 'Min']
563
  data_cols = ['team_score', 'opp_score', 'spread', 'Touches', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M',
@@ -576,7 +576,7 @@ if selected_tab == 'Position vs. Opp':
576
  total_players = indv_players.Player.values.tolist()
577
  total_dates = gamelog_table.Date.values.tolist()
578
 
579
- gamelog_table, game_rot, timestamp = init_baselines('gamelogs')
580
  indv_teams = gamelog_table.drop_duplicates(subset='Team')
581
  total_teams = indv_teams.Team.values.tolist()
582
  indv_players = gamelog_table.drop_duplicates(subset='Player')
@@ -646,7 +646,7 @@ if selected_tab == 'Game Rotations':
646
  with col1:
647
  if st.button("Reset Data", key='reset5'):
648
  st.cache_data.clear()
649
- gamelog_table, game_rot, timestamp = init_baselines('all')
650
 
651
  basic_cols = ['Player', 'Pos', 'Team', 'Opp', 'Season', 'Date', 'Matchup', 'Min']
652
  basic_season_cols = ['Pos', 'Team', 'Min']
@@ -668,8 +668,9 @@ if selected_tab == 'Game Rotations':
668
  total_players = indv_players.Player.values.tolist()
669
  total_dates = gamelog_table.Date.values.tolist()
670
 
671
- gamelog_table, game_rot, timestamp = init_baselines('all')
672
  st.write(game_rot['stint_id'].head(10))
 
673
  basic_cols = ['Player', 'Pos', 'Team', 'Team Abbr', 'Opp', 'Opp Abbr', 'Season', 'Date', 'Matchup', 'Min']
674
  basic_season_cols = ['Pos', 'Team', 'Team Abbr', 'Min']
675
  data_cols = ['team_score', 'opp_score', 'spread', 'Touches', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M',
 
211
  except Exception:
212
  pass # Silently continue if stint stats unavailable
213
 
214
+ return gamelog_table, game_rot, stint_stats.head(10) | None, timestamp
215
 
216
  @st.cache_data(show_spinner=False)
217
  def seasonlong_build(data_sample):
 
329
  with col1:
330
  if st.button("Reset Data", key='reset1'):
331
  st.cache_data.clear()
332
+ gamelog_table, game_rot, stint_stats, timestamp = init_baselines('gamelogs')
333
  basic_cols = ['Player', 'Pos', 'Team', 'Opp', 'Season', 'Date', 'Matchup', 'Min']
334
  basic_season_cols = ['Pos', 'Team', 'Min']
335
  data_cols = ['team_score', 'opp_score', 'spread', 'Touches', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M',
 
348
  total_players = indv_players.Player.values.tolist()
349
  total_dates = gamelog_table.Date.values.tolist()
350
 
351
+ gamelog_table, game_rot, stint_stats, timestamp = init_baselines('gamelogs')
352
  indv_teams = gamelog_table.drop_duplicates(subset='Team')
353
  total_teams = indv_teams.Team.values.tolist()
354
  indv_players = gamelog_table.drop_duplicates(subset='Player')
 
460
  with col1:
461
  if st.button("Reset Data", key='reset2'):
462
  st.cache_data.clear()
463
+ gamelog_table, game_rot, stint_stats, timestamp = init_baselines('gamelogs')
464
  basic_cols = ['Player', 'Pos', 'Team', 'Opp', 'Season', 'Date', 'Matchup', 'Min']
465
  basic_season_cols = ['Pos', 'Team', 'Min']
466
  data_cols = ['team_score', 'opp_score', 'spread', 'Touches', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M',
 
479
  total_players = indv_players.Player.values.tolist()
480
  total_dates = gamelog_table.Date.values.tolist()
481
 
482
+ gamelog_table, game_rot, stint_stats, timestamp = init_baselines('gamelogs')
483
  indv_teams = gamelog_table.drop_duplicates(subset='Team')
484
  total_teams = indv_teams.Team.values.tolist()
485
  indv_players = gamelog_table.drop_duplicates(subset='Player')
 
557
  with col1:
558
  if st.button("Reset Data", key='reset3'):
559
  st.cache_data.clear()
560
+ gamelog_table, game_rot, stint_stats, timestamp = init_baselines('gamelogs')
561
  basic_cols = ['Player', 'Pos', 'Team', 'Opp', 'Season', 'Date', 'Matchup', 'Min']
562
  basic_season_cols = ['Pos', 'Team', 'Min']
563
  data_cols = ['team_score', 'opp_score', 'spread', 'Touches', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M',
 
576
  total_players = indv_players.Player.values.tolist()
577
  total_dates = gamelog_table.Date.values.tolist()
578
 
579
+ gamelog_table, game_rot, stint_stats, timestamp = init_baselines('gamelogs')
580
  indv_teams = gamelog_table.drop_duplicates(subset='Team')
581
  total_teams = indv_teams.Team.values.tolist()
582
  indv_players = gamelog_table.drop_duplicates(subset='Player')
 
646
  with col1:
647
  if st.button("Reset Data", key='reset5'):
648
  st.cache_data.clear()
649
+ gamelog_table, game_rot, stint_stats, timestamp = init_baselines('all')
650
 
651
  basic_cols = ['Player', 'Pos', 'Team', 'Opp', 'Season', 'Date', 'Matchup', 'Min']
652
  basic_season_cols = ['Pos', 'Team', 'Min']
 
668
  total_players = indv_players.Player.values.tolist()
669
  total_dates = gamelog_table.Date.values.tolist()
670
 
671
+ gamelog_table, game_rot, stint_stats, timestamp = init_baselines('all')
672
  st.write(game_rot['stint_id'].head(10))
673
+ st.write(stint_stats['stint_id'].head(10))
674
  basic_cols = ['Player', 'Pos', 'Team', 'Team Abbr', 'Opp', 'Opp Abbr', 'Season', 'Date', 'Matchup', 'Min']
675
  basic_season_cols = ['Pos', 'Team', 'Team Abbr', 'Min']
676
  data_cols = ['team_score', 'opp_score', 'spread', 'Touches', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M',