Spaces:
Running
Running
James McCool
commited on
Commit
·
85cdf44
1
Parent(s):
47ed87e
optimizing queries inside of segments
Browse files- src/streamlit_app.py +83 -26
src/streamlit_app.py
CHANGED
|
@@ -64,7 +64,7 @@ def init_baselines(data_req: str):
|
|
| 64 |
|
| 65 |
raw_display = pd.DataFrame(list(cursor))
|
| 66 |
gamelog_table = raw_display[raw_display['PLAYER_NAME'] != ""]
|
| 67 |
-
gamelog_table = gamelog_table[['PLAYER_NAME', 'POS', 'GAME_ID', 'TEAM_NAME', 'OPP_NAME', 'SEASON_ID', 'GAME_DATE', 'MATCHUP', 'MIN', 'touches', 'PTS', 'FGM', 'FGA', 'FG_PCT', 'FG3M', 'FG3A',
|
| 68 |
'FG3_PCT', 'FTM', 'FTA', 'FT_PCT', 'reboundChancesOffensive', 'OREB', 'reboundChancesDefensive', 'DREB', 'reboundChancesTotal', 'REB',
|
| 69 |
'passes', 'secondaryAssists', 'freeThrowAssists', 'assists', 'STL', 'BLK', 'TOV', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy', 'FPPM']]
|
| 70 |
gamelog_table['assists'].replace("", 0, inplace=True)
|
|
@@ -98,7 +98,7 @@ def init_baselines(data_req: str):
|
|
| 98 |
|
| 99 |
spread_dict = dict(zip(gamelog_table['GAME_ID'], gamelog_table['spread']))
|
| 100 |
|
| 101 |
-
gamelog_table = gamelog_table.set_axis(['Player', 'Pos', 'game_id', 'Team', 'Opp', 'Season', 'Date', 'Matchup', 'Min', 'Touches', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M',
|
| 102 |
'FG3A', 'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
|
| 103 |
'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy', 'FPPM',
|
| 104 |
'Rebound%', 'Assists/Pass', 'Touch_per_min', 'Fantasy/Touch', 'FD Fantasy/Touch', 'team_score', 'opp_score', 'spread'], axis=1)
|
|
@@ -124,7 +124,7 @@ def init_baselines(data_req: str):
|
|
| 124 |
|
| 125 |
raw_display = pd.DataFrame(list(cursor))
|
| 126 |
gamelog_table = raw_display[raw_display['PLAYER_NAME'] != ""]
|
| 127 |
-
gamelog_table = gamelog_table[['PLAYER_NAME', 'POS', 'GAME_ID', 'TEAM_NAME', 'OPP_NAME', 'SEASON_ID', 'GAME_DATE', 'MATCHUP', 'MIN', 'touches', 'PTS', 'FGM', 'FGA', 'FG_PCT', 'FG3M', 'FG3A',
|
| 128 |
'FG3_PCT', 'FTM', 'FTA', 'FT_PCT', 'reboundChancesOffensive', 'OREB', 'reboundChancesDefensive', 'DREB', 'reboundChancesTotal', 'REB',
|
| 129 |
'passes', 'secondaryAssists', 'freeThrowAssists', 'assists', 'STL', 'BLK', 'TOV', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy', 'FPPM']]
|
| 130 |
gamelog_table['assists'].replace("", 0, inplace=True)
|
|
@@ -158,7 +158,7 @@ def init_baselines(data_req: str):
|
|
| 158 |
|
| 159 |
spread_dict = dict(zip(gamelog_table['GAME_ID'], gamelog_table['spread']))
|
| 160 |
|
| 161 |
-
gamelog_table = gamelog_table.set_axis(['Player', 'Pos', 'game_id', 'Team', 'Opp', 'Season', 'Date', 'Matchup', 'Min', 'Touches', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M',
|
| 162 |
'FG3A', 'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
|
| 163 |
'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy', 'FPPM',
|
| 164 |
'Rebound%', 'Assists/Pass', 'Touch_per_min', 'Fantasy/Touch', 'FD Fantasy/Touch', 'team_score', 'opp_score', 'spread'], axis=1)
|
|
@@ -278,27 +278,6 @@ def split_frame(input_df, rows):
|
|
| 278 |
def convert_df_to_csv(df):
|
| 279 |
return df.to_csv().encode('utf-8')
|
| 280 |
|
| 281 |
-
gamelog_table, game_rot, timestamp = init_baselines('gamelogs')
|
| 282 |
-
basic_cols = ['Player', 'Pos', 'Team', 'Opp', 'Season', 'Date', 'Matchup', 'Min']
|
| 283 |
-
basic_season_cols = ['Pos', 'Team', 'Min']
|
| 284 |
-
data_cols = ['team_score', 'opp_score', 'spread', 'Touches', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M',
|
| 285 |
-
'FG3A', 'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
|
| 286 |
-
'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
|
| 287 |
-
'FPPM', 'Rebound%', 'Assists/Pass', 'Touch_per_min', 'Fantasy/Touch', 'FD Fantasy/Touch']
|
| 288 |
-
season_data_cols = ['Touches', 'Touch/Min', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M', 'FG3A',
|
| 289 |
-
'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
|
| 290 |
-
'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
|
| 291 |
-
'FPPM', 'Rebound%', 'Assists/Pass', 'Fantasy/Touch', 'FD Fantasy/Touch']
|
| 292 |
-
game_rot_cols = ['PLAYER_NAME', 'backlog_lookup', 'spread', 'MIN', 'PTS', 'FGM', 'FGA', 'FG3M', 'FG3A', 'FTM', 'FTA', 'REB', 'AST', 'STL', 'BLK', 'TOV', 'PF',
|
| 293 |
-
'Fantasy', 'FD_Fantasy']
|
| 294 |
-
indv_teams = gamelog_table.drop_duplicates(subset='Team')
|
| 295 |
-
total_teams = indv_teams.Team.values.tolist()
|
| 296 |
-
indv_players = gamelog_table.drop_duplicates(subset='Player')
|
| 297 |
-
total_players = indv_players.Player.values.tolist()
|
| 298 |
-
total_dates = gamelog_table.Date.values.tolist()
|
| 299 |
-
|
| 300 |
-
# tab1, tab2, tab3, tab4, tab5 = st.tabs(['Gamelogs', 'Correlation Matrix', 'Position vs. Opp', 'Positional Percentages', 'Game Rotations'])
|
| 301 |
-
|
| 302 |
selected_tab = st.segmented_control(
|
| 303 |
"Select Tab",
|
| 304 |
options=['Gamelogs', 'Correlation Matrix', 'Position vs. Opp', 'Game Rotations'],
|
|
@@ -333,6 +312,25 @@ if selected_tab == 'Gamelogs':
|
|
| 333 |
total_players = indv_players.Player.values.tolist()
|
| 334 |
total_dates = gamelog_table.Date.values.tolist()
|
| 335 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 336 |
split_var1 = st.radio("What table would you like to view?", ('Season Logs', 'Gamelogs'), key='split_var1')
|
| 337 |
split_var2 = st.radio("Would you like to view all teams or specific ones?", ('All', 'Specific Teams'), key='split_var2')
|
| 338 |
|
|
@@ -457,6 +455,25 @@ if selected_tab == 'Correlation Matrix':
|
|
| 457 |
total_players = indv_players.Player.values.tolist()
|
| 458 |
total_dates = gamelog_table.Date.values.tolist()
|
| 459 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 460 |
corr_var = st.radio("Are you correlating fantasy or minutes?", ('Fantasy', 'Minutes'), key='corr_var')
|
| 461 |
|
| 462 |
split_var1_t2 = st.radio("Would you like to view specific teams or specific players?", ('Specific Teams', 'Specific Players'), key='split_var1_t2')
|
|
@@ -547,6 +564,25 @@ if selected_tab == 'Position vs. Opp':
|
|
| 547 |
total_players = indv_players.Player.values.tolist()
|
| 548 |
total_dates = gamelog_table.Date.values.tolist()
|
| 549 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 550 |
team_var3 = st.selectbox('Which opponent would you like to view?', options = total_teams, key='team_var3')
|
| 551 |
pos_var3 = st.selectbox('Which position would you like to view?', options = ['PG', 'SG', 'SF', 'PF', 'C'], key='pos_var3')
|
| 552 |
disp_var3 = st.radio('Which view would you like to see?', options = ['Fantasy', 'Stats'], key='disp_var3')
|
|
@@ -610,7 +646,7 @@ if selected_tab == 'Game Rotations':
|
|
| 610 |
with col1:
|
| 611 |
if st.button("Reset Data", key='reset5'):
|
| 612 |
st.cache_data.clear()
|
| 613 |
-
gamelog_table, game_rot, timestamp = init_baselines('
|
| 614 |
basic_cols = ['Player', 'Pos', 'Team', 'Opp', 'Season', 'Date', 'Matchup', 'Min']
|
| 615 |
basic_season_cols = ['Pos', 'Team', 'Min']
|
| 616 |
data_cols = ['team_score', 'opp_score', 'spread', 'Touches', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M',
|
|
@@ -631,6 +667,27 @@ if selected_tab == 'Game Rotations':
|
|
| 631 |
total_players = indv_players.Player.values.tolist()
|
| 632 |
total_dates = gamelog_table.Date.values.tolist()
|
| 633 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 634 |
game_rot_view = st.radio("What set would you like to view?", ('Team Rotations', 'Player Rotations'), key='game_rot_view')
|
| 635 |
|
| 636 |
if game_rot_view == 'Team Rotations':
|
|
|
|
| 64 |
|
| 65 |
raw_display = pd.DataFrame(list(cursor))
|
| 66 |
gamelog_table = raw_display[raw_display['PLAYER_NAME'] != ""]
|
| 67 |
+
gamelog_table = gamelog_table[['PLAYER_NAME', 'POS', 'GAME_ID', 'TEAM_NAME', 'TEAM_ABBREVIATION', 'OPP_NAME', 'OPP_ABBREVIATION', 'SEASON_ID', 'GAME_DATE', 'MATCHUP', 'MIN', 'touches', 'PTS', 'FGM', 'FGA', 'FG_PCT', 'FG3M', 'FG3A',
|
| 68 |
'FG3_PCT', 'FTM', 'FTA', 'FT_PCT', 'reboundChancesOffensive', 'OREB', 'reboundChancesDefensive', 'DREB', 'reboundChancesTotal', 'REB',
|
| 69 |
'passes', 'secondaryAssists', 'freeThrowAssists', 'assists', 'STL', 'BLK', 'TOV', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy', 'FPPM']]
|
| 70 |
gamelog_table['assists'].replace("", 0, inplace=True)
|
|
|
|
| 98 |
|
| 99 |
spread_dict = dict(zip(gamelog_table['GAME_ID'], gamelog_table['spread']))
|
| 100 |
|
| 101 |
+
gamelog_table = gamelog_table.set_axis(['Player', 'Pos', 'game_id', 'Team', 'Team Abbr', 'Opp', 'Opp Abbr', 'Season', 'Date', 'Matchup', 'Min', 'Touches', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M',
|
| 102 |
'FG3A', 'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
|
| 103 |
'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy', 'FPPM',
|
| 104 |
'Rebound%', 'Assists/Pass', 'Touch_per_min', 'Fantasy/Touch', 'FD Fantasy/Touch', 'team_score', 'opp_score', 'spread'], axis=1)
|
|
|
|
| 124 |
|
| 125 |
raw_display = pd.DataFrame(list(cursor))
|
| 126 |
gamelog_table = raw_display[raw_display['PLAYER_NAME'] != ""]
|
| 127 |
+
gamelog_table = gamelog_table[['PLAYER_NAME', 'POS', 'GAME_ID', 'TEAM_NAME', 'TEAM_ABBREVIATION', 'OPP_NAME', 'OPP_ABBREVIATION', 'SEASON_ID', 'GAME_DATE', 'MATCHUP', 'MIN', 'touches', 'PTS', 'FGM', 'FGA', 'FG_PCT', 'FG3M', 'FG3A',
|
| 128 |
'FG3_PCT', 'FTM', 'FTA', 'FT_PCT', 'reboundChancesOffensive', 'OREB', 'reboundChancesDefensive', 'DREB', 'reboundChancesTotal', 'REB',
|
| 129 |
'passes', 'secondaryAssists', 'freeThrowAssists', 'assists', 'STL', 'BLK', 'TOV', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy', 'FPPM']]
|
| 130 |
gamelog_table['assists'].replace("", 0, inplace=True)
|
|
|
|
| 158 |
|
| 159 |
spread_dict = dict(zip(gamelog_table['GAME_ID'], gamelog_table['spread']))
|
| 160 |
|
| 161 |
+
gamelog_table = gamelog_table.set_axis(['Player', 'Pos', 'game_id', 'Team', 'Team Abbr', 'Opp', 'Opp Abbr', 'Season', 'Date', 'Matchup', 'Min', 'Touches', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M',
|
| 162 |
'FG3A', 'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
|
| 163 |
'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy', 'FPPM',
|
| 164 |
'Rebound%', 'Assists/Pass', 'Touch_per_min', 'Fantasy/Touch', 'FD Fantasy/Touch', 'team_score', 'opp_score', 'spread'], axis=1)
|
|
|
|
| 278 |
def convert_df_to_csv(df):
|
| 279 |
return df.to_csv().encode('utf-8')
|
| 280 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 281 |
selected_tab = st.segmented_control(
|
| 282 |
"Select Tab",
|
| 283 |
options=['Gamelogs', 'Correlation Matrix', 'Position vs. Opp', 'Game Rotations'],
|
|
|
|
| 312 |
total_players = indv_players.Player.values.tolist()
|
| 313 |
total_dates = gamelog_table.Date.values.tolist()
|
| 314 |
|
| 315 |
+
gamelog_table, game_rot, timestamp = init_baselines('gamelogs')
|
| 316 |
+
basic_cols = ['Player', 'Pos', 'Team', 'Team Abbr', 'Opp', 'Opp Abbr', 'Season', 'Date', 'Matchup', 'Min']
|
| 317 |
+
basic_season_cols = ['Pos', 'Team', 'Team Abbr', 'Min']
|
| 318 |
+
data_cols = ['team_score', 'opp_score', 'spread', 'Touches', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M',
|
| 319 |
+
'FG3A', 'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
|
| 320 |
+
'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
|
| 321 |
+
'FPPM', 'Rebound%', 'Assists/Pass', 'Touch_per_min', 'Fantasy/Touch', 'FD Fantasy/Touch']
|
| 322 |
+
season_data_cols = ['Touches', 'Touch/Min', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M', 'FG3A',
|
| 323 |
+
'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
|
| 324 |
+
'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
|
| 325 |
+
'FPPM', 'Rebound%', 'Assists/Pass', 'Fantasy/Touch', 'FD Fantasy/Touch']
|
| 326 |
+
game_rot_cols = ['PLAYER_NAME', 'backlog_lookup', 'spread', 'MIN', 'PTS', 'FGM', 'FGA', 'FG3M', 'FG3A', 'FTM', 'FTA', 'REB', 'AST', 'STL', 'BLK', 'TOV', 'PF',
|
| 327 |
+
'Fantasy', 'FD_Fantasy']
|
| 328 |
+
indv_teams = gamelog_table.drop_duplicates(subset='Team')
|
| 329 |
+
total_teams = indv_teams.Team.values.tolist()
|
| 330 |
+
indv_players = gamelog_table.drop_duplicates(subset='Player')
|
| 331 |
+
total_players = indv_players.Player.values.tolist()
|
| 332 |
+
total_dates = gamelog_table.Date.values.tolist()
|
| 333 |
+
|
| 334 |
split_var1 = st.radio("What table would you like to view?", ('Season Logs', 'Gamelogs'), key='split_var1')
|
| 335 |
split_var2 = st.radio("Would you like to view all teams or specific ones?", ('All', 'Specific Teams'), key='split_var2')
|
| 336 |
|
|
|
|
| 455 |
total_players = indv_players.Player.values.tolist()
|
| 456 |
total_dates = gamelog_table.Date.values.tolist()
|
| 457 |
|
| 458 |
+
gamelog_table, game_rot, timestamp = init_baselines('gamelogs')
|
| 459 |
+
basic_cols = ['Player', 'Pos', 'Team', 'Team Abbr', 'Opp', 'Opp Abbr', 'Season', 'Date', 'Matchup', 'Min']
|
| 460 |
+
basic_season_cols = ['Pos', 'Team', 'Team Abbr', 'Min']
|
| 461 |
+
data_cols = ['team_score', 'opp_score', 'spread', 'Touches', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M',
|
| 462 |
+
'FG3A', 'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
|
| 463 |
+
'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
|
| 464 |
+
'FPPM', 'Rebound%', 'Assists/Pass', 'Touch_per_min', 'Fantasy/Touch', 'FD Fantasy/Touch']
|
| 465 |
+
season_data_cols = ['Touches', 'Touch/Min', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M', 'FG3A',
|
| 466 |
+
'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
|
| 467 |
+
'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
|
| 468 |
+
'FPPM', 'Rebound%', 'Assists/Pass', 'Fantasy/Touch', 'FD Fantasy/Touch']
|
| 469 |
+
game_rot_cols = ['PLAYER_NAME', 'backlog_lookup', 'spread', 'MIN', 'PTS', 'FGM', 'FGA', 'FG3M', 'FG3A', 'FTM', 'FTA', 'REB', 'AST', 'STL', 'BLK', 'TOV', 'PF',
|
| 470 |
+
'Fantasy', 'FD_Fantasy']
|
| 471 |
+
indv_teams = gamelog_table.drop_duplicates(subset='Team')
|
| 472 |
+
total_teams = indv_teams.Team.values.tolist()
|
| 473 |
+
indv_players = gamelog_table.drop_duplicates(subset='Player')
|
| 474 |
+
total_players = indv_players.Player.values.tolist()
|
| 475 |
+
total_dates = gamelog_table.Date.values.tolist()
|
| 476 |
+
|
| 477 |
corr_var = st.radio("Are you correlating fantasy or minutes?", ('Fantasy', 'Minutes'), key='corr_var')
|
| 478 |
|
| 479 |
split_var1_t2 = st.radio("Would you like to view specific teams or specific players?", ('Specific Teams', 'Specific Players'), key='split_var1_t2')
|
|
|
|
| 564 |
total_players = indv_players.Player.values.tolist()
|
| 565 |
total_dates = gamelog_table.Date.values.tolist()
|
| 566 |
|
| 567 |
+
gamelog_table, game_rot, timestamp = init_baselines('gamelogs')
|
| 568 |
+
basic_cols = ['Player', 'Pos', 'Team', 'Team Abbr', 'Opp', 'Opp Abbr', 'Season', 'Date', 'Matchup', 'Min']
|
| 569 |
+
basic_season_cols = ['Pos', 'Team', 'Team Abbr', 'Min']
|
| 570 |
+
data_cols = ['team_score', 'opp_score', 'spread', 'Touches', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M',
|
| 571 |
+
'FG3A', 'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
|
| 572 |
+
'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
|
| 573 |
+
'FPPM', 'Rebound%', 'Assists/Pass', 'Touch_per_min', 'Fantasy/Touch', 'FD Fantasy/Touch']
|
| 574 |
+
season_data_cols = ['Touches', 'Touch/Min', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M', 'FG3A',
|
| 575 |
+
'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
|
| 576 |
+
'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
|
| 577 |
+
'FPPM', 'Rebound%', 'Assists/Pass', 'Fantasy/Touch', 'FD Fantasy/Touch']
|
| 578 |
+
game_rot_cols = ['PLAYER_NAME', 'backlog_lookup', 'spread', 'MIN', 'PTS', 'FGM', 'FGA', 'FG3M', 'FG3A', 'FTM', 'FTA', 'REB', 'AST', 'STL', 'BLK', 'TOV', 'PF',
|
| 579 |
+
'Fantasy', 'FD_Fantasy']
|
| 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')
|
| 583 |
+
total_players = indv_players.Player.values.tolist()
|
| 584 |
+
total_dates = gamelog_table.Date.values.tolist()
|
| 585 |
+
|
| 586 |
team_var3 = st.selectbox('Which opponent would you like to view?', options = total_teams, key='team_var3')
|
| 587 |
pos_var3 = st.selectbox('Which position would you like to view?', options = ['PG', 'SG', 'SF', 'PF', 'C'], key='pos_var3')
|
| 588 |
disp_var3 = st.radio('Which view would you like to see?', options = ['Fantasy', 'Stats'], key='disp_var3')
|
|
|
|
| 646 |
with col1:
|
| 647 |
if st.button("Reset Data", key='reset5'):
|
| 648 |
st.cache_data.clear()
|
| 649 |
+
gamelog_table, game_rot, timestamp = init_baselines('game_rotations')
|
| 650 |
basic_cols = ['Player', 'Pos', 'Team', 'Opp', 'Season', 'Date', 'Matchup', 'Min']
|
| 651 |
basic_season_cols = ['Pos', 'Team', 'Min']
|
| 652 |
data_cols = ['team_score', 'opp_score', 'spread', 'Touches', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M',
|
|
|
|
| 667 |
total_players = indv_players.Player.values.tolist()
|
| 668 |
total_dates = gamelog_table.Date.values.tolist()
|
| 669 |
|
| 670 |
+
gamelog_table, game_rot, timestamp = init_baselines('game_rotations')
|
| 671 |
+
basic_cols = ['Player', 'Pos', 'Team', 'Team Abbr', 'Opp', 'Opp Abbr', 'Season', 'Date', 'Matchup', 'Min']
|
| 672 |
+
basic_season_cols = ['Pos', 'Team', 'Team Abbr', 'Min']
|
| 673 |
+
data_cols = ['team_score', 'opp_score', 'spread', 'Touches', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M',
|
| 674 |
+
'FG3A', 'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
|
| 675 |
+
'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
|
| 676 |
+
'FPPM', 'Rebound%', 'Assists/Pass', 'Touch_per_min', 'Fantasy/Touch', 'FD Fantasy/Touch']
|
| 677 |
+
season_data_cols = ['Touches', 'Touch/Min', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M', 'FG3A',
|
| 678 |
+
'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
|
| 679 |
+
'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
|
| 680 |
+
'FPPM', 'Rebound%', 'Assists/Pass', 'Fantasy/Touch', 'FD Fantasy/Touch']
|
| 681 |
+
game_rot_cols = ['PLAYER_NAME', 'backlog_lookup', 'spread', 'MIN', 'PTS', 'FGM', 'FGA', 'FG3M', 'FG3A', 'FTM', 'FTA', 'REB', 'AST', 'STL', 'BLK', 'TOV', 'PF',
|
| 682 |
+
'Fantasy', 'FD_Fantasy']
|
| 683 |
+
indv_teams = gamelog_table.drop_duplicates(subset='Team')
|
| 684 |
+
total_teams = indv_teams.Team.values.tolist()
|
| 685 |
+
indv_game_rot_teams = game_rot.drop_duplicates(subset='TEAM_ABBREVIATION')
|
| 686 |
+
total_game_rot_teams = indv_game_rot_teams.TEAM_ABBREVIATION.values.tolist()
|
| 687 |
+
indv_players = gamelog_table.drop_duplicates(subset='Player')
|
| 688 |
+
total_players = indv_players.Player.values.tolist()
|
| 689 |
+
total_dates = gamelog_table.Date.values.tolist()
|
| 690 |
+
|
| 691 |
game_rot_view = st.radio("What set would you like to view?", ('Team Rotations', 'Player Rotations'), key='game_rot_view')
|
| 692 |
|
| 693 |
if game_rot_view == 'Team Rotations':
|