James McCool commited on
Commit
7907e2d
·
1 Parent(s): f4cc261

Adding some leading zeros to the stint ID for the game rotations frames.

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +3 -4
src/streamlit_app.py CHANGED
@@ -183,8 +183,9 @@ def init_baselines(data_req: str):
183
  stint_stats = pd.DataFrame(list(cursor))
184
 
185
  if len(stint_stats) > 0:
186
- # Create stint_id in game_rot for merging (ensure float format to match data hook)
187
- game_rot['stint_id'] = (game_rot['GAME_ID'].astype(str) + '_' +
 
188
  game_rot['PERSON_ID'].astype(str) + '_' +
189
  game_rot['Start'].apply(lambda x: str(float(x))))
190
 
@@ -670,8 +671,6 @@ if selected_tab == 'Game Rotations':
670
  total_dates = gamelog_table.Date.values.tolist()
671
 
672
  gamelog_table, game_rot, stint_stats, timestamp = init_baselines('all')
673
- st.write(game_rot['stint_id'].head(10))
674
- st.write(stint_stats['stint_id'].head(10))
675
  basic_cols = ['Player', 'Pos', 'Team', 'Team Abbr', 'Opp', 'Opp Abbr', 'Season', 'Date', 'Matchup', 'Min']
676
  basic_season_cols = ['Pos', 'Team', 'Team Abbr', 'Min']
677
  data_cols = ['team_score', 'opp_score', 'spread', 'Touches', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M',
 
183
  stint_stats = pd.DataFrame(list(cursor))
184
 
185
  if len(stint_stats) > 0:
186
+ # Create stint_id in game_rot for merging
187
+ # GAME_ID needs leading zeros (10 chars) to match stint_stats format
188
+ game_rot['stint_id'] = (game_rot['GAME_ID'].astype(str).str.zfill(10) + '_' +
189
  game_rot['PERSON_ID'].astype(str) + '_' +
190
  game_rot['Start'].apply(lambda x: str(float(x))))
191
 
 
671
  total_dates = gamelog_table.Date.values.tolist()
672
 
673
  gamelog_table, game_rot, stint_stats, timestamp = init_baselines('all')
 
 
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',