Multichem commited on
Commit
c2acd71
·
1 Parent(s): 1b3ff31

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -2
app.py CHANGED
@@ -226,6 +226,8 @@ season_data_cols = ['Touches', 'Touch/Min', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M',
226
  'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
227
  'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
228
  'Rebound%', 'Assists/Pass', 'Fantasy/Touch', 'FD Fantasy/Touch']
 
 
229
  indv_teams = gamelog_table.drop_duplicates(subset='Team')
230
  total_teams = indv_teams.Team.values.tolist()
231
  indv_rot_teams = rot_table.drop_duplicates(subset='Team')
@@ -255,6 +257,8 @@ with tab1:
255
  'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
256
  'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
257
  'Rebound%', 'Assists/Pass', 'Fantasy/Touch', 'FD Fantasy/Touch']
 
 
258
  indv_teams = gamelog_table.drop_duplicates(subset='Team')
259
  total_teams = indv_teams.Team.values.tolist()
260
  indv_rot_teams = rot_table.drop_duplicates(subset='Team')
@@ -382,6 +386,8 @@ with tab2:
382
  'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
383
  'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
384
  'Rebound%', 'Assists/Pass', 'Fantasy/Touch', 'FD Fantasy/Touch']
 
 
385
  indv_teams = gamelog_table.drop_duplicates(subset='Team')
386
  total_teams = indv_teams.Team.values.tolist()
387
  indv_rot_teams = rot_table.drop_duplicates(subset='Team')
@@ -475,6 +481,8 @@ with tab3:
475
  'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
476
  'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
477
  'Rebound%', 'Assists/Pass', 'Fantasy/Touch', 'FD Fantasy/Touch']
 
 
478
  indv_teams = gamelog_table.drop_duplicates(subset='Team')
479
  total_teams = indv_teams.Team.values.tolist()
480
  indv_rot_teams = rot_table.drop_duplicates(subset='Team')
@@ -560,6 +568,8 @@ with tab4:
560
  'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
561
  'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
562
  'Rebound%', 'Assists/Pass', 'Fantasy/Touch', 'FD Fantasy/Touch']
 
 
563
  indv_teams = gamelog_table.drop_duplicates(subset='Team')
564
  total_teams = indv_teams.Team.values.tolist()
565
  indv_rot_teams = rot_table.drop_duplicates(subset='Team')
@@ -594,7 +604,7 @@ with tab4:
594
 
595
  with tab5:
596
  st.info(t_stamp)
597
- col1, col2 = st.columns([2, 8])
598
  with col1:
599
  if st.button("Reset Data", key='reset5'):
600
  st.cache_data.clear()
@@ -609,6 +619,8 @@ with tab5:
609
  'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
610
  'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
611
  'Rebound%', 'Assists/Pass', 'Fantasy/Touch', 'FD Fantasy/Touch']
 
 
612
  indv_teams = gamelog_table.drop_duplicates(subset='Team')
613
  total_teams = indv_teams.Team.values.tolist()
614
  indv_rot_teams = rot_table.drop_duplicates(subset='Team')
@@ -654,8 +666,10 @@ with tab5:
654
  working_data = game_rot
655
  if game_rot_view == 'Player Rotations':
656
  display = st.container()
 
657
  check_rotation = working_data[working_data['backlog_lookup'] == game_id_var]
658
  check_rotation = check_rotation.sort_values(by='Start', ascending=True)
 
659
 
660
  fig = px.timeline(check_rotation, x_start="Start", x_end="Finish", y="Task", range_x=[0,check_rotation["Finish"].max()], text='minutes')
661
  fig.update_yaxes(autorange="reversed")
@@ -667,11 +681,14 @@ with tab5:
667
  fig.add_vline(x=36, line_width=3, line_dash="dash", line_color="green")
668
  # pages = pages.set_index('Player')
669
  display.plotly_chart(fig, use_container_width=True)
 
670
 
671
  elif game_rot_view == 'Team Rotations':
672
  display = st.container()
 
673
  check_rotation = working_data[working_data['backlog_lookup'] == game_id_var]
674
  check_rotation = check_rotation.sort_values(by='Start', ascending=True)
 
675
 
676
  fig = px.timeline(check_rotation, x_start="Start", x_end="Finish", y="Task", range_x=[0,check_rotation["Finish"].max()], text='minutes')
677
  fig.update_yaxes(autorange="reversed")
@@ -682,4 +699,5 @@ with tab5:
682
  fig.add_vline(x=24, line_width=3, line_dash="dash", line_color="green")
683
  fig.add_vline(x=36, line_width=3, line_dash="dash", line_color="green")
684
  # pages = pages.set_index('Player')
685
- display.plotly_chart(fig, theme=None, use_container_width=True)
 
 
226
  'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
227
  'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
228
  'Rebound%', 'Assists/Pass', 'Fantasy/Touch', 'FD Fantasy/Touch']
229
+ game_rot_cols = ['Pts', 'FGM', 'FGA', 'FG%', 'FG3M', 'FG3A', 'FG3%', 'FTM', 'FTA', 'FT%', 'REB', 'Assists', 'Stl', 'Blk', 'Tov', 'PF',
230
+ 'DD', 'TD', 'Fantasy', 'FD_Fantasy']
231
  indv_teams = gamelog_table.drop_duplicates(subset='Team')
232
  total_teams = indv_teams.Team.values.tolist()
233
  indv_rot_teams = rot_table.drop_duplicates(subset='Team')
 
257
  'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
258
  'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
259
  'Rebound%', 'Assists/Pass', 'Fantasy/Touch', 'FD Fantasy/Touch']
260
+ game_rot_cols = ['Pts', 'FGM', 'FGA', 'FG%', 'FG3M', 'FG3A', 'FG3%', 'FTM', 'FTA', 'FT%', 'REB', 'Assists', 'Stl', 'Blk', 'Tov', 'PF',
261
+ 'DD', 'TD', 'Fantasy', 'FD_Fantasy']
262
  indv_teams = gamelog_table.drop_duplicates(subset='Team')
263
  total_teams = indv_teams.Team.values.tolist()
264
  indv_rot_teams = rot_table.drop_duplicates(subset='Team')
 
386
  'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
387
  'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
388
  'Rebound%', 'Assists/Pass', 'Fantasy/Touch', 'FD Fantasy/Touch']
389
+ game_rot_cols = ['Pts', 'FGM', 'FGA', 'FG%', 'FG3M', 'FG3A', 'FG3%', 'FTM', 'FTA', 'FT%', 'REB', 'Assists', 'Stl', 'Blk', 'Tov', 'PF',
390
+ 'DD', 'TD', 'Fantasy', 'FD_Fantasy']
391
  indv_teams = gamelog_table.drop_duplicates(subset='Team')
392
  total_teams = indv_teams.Team.values.tolist()
393
  indv_rot_teams = rot_table.drop_duplicates(subset='Team')
 
481
  'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
482
  'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
483
  'Rebound%', 'Assists/Pass', 'Fantasy/Touch', 'FD Fantasy/Touch']
484
+ game_rot_cols = ['Pts', 'FGM', 'FGA', 'FG%', 'FG3M', 'FG3A', 'FG3%', 'FTM', 'FTA', 'FT%', 'REB', 'Assists', 'Stl', 'Blk', 'Tov', 'PF',
485
+ 'DD', 'TD', 'Fantasy', 'FD_Fantasy']
486
  indv_teams = gamelog_table.drop_duplicates(subset='Team')
487
  total_teams = indv_teams.Team.values.tolist()
488
  indv_rot_teams = rot_table.drop_duplicates(subset='Team')
 
568
  'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
569
  'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
570
  'Rebound%', 'Assists/Pass', 'Fantasy/Touch', 'FD Fantasy/Touch']
571
+ game_rot_cols = ['Pts', 'FGM', 'FGA', 'FG%', 'FG3M', 'FG3A', 'FG3%', 'FTM', 'FTA', 'FT%', 'REB', 'Assists', 'Stl', 'Blk', 'Tov', 'PF',
572
+ 'DD', 'TD', 'Fantasy', 'FD_Fantasy']
573
  indv_teams = gamelog_table.drop_duplicates(subset='Team')
574
  total_teams = indv_teams.Team.values.tolist()
575
  indv_rot_teams = rot_table.drop_duplicates(subset='Team')
 
604
 
605
  with tab5:
606
  st.info(t_stamp)
607
+ col1, col2 = st.columns([1, 9])
608
  with col1:
609
  if st.button("Reset Data", key='reset5'):
610
  st.cache_data.clear()
 
619
  'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
620
  'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
621
  'Rebound%', 'Assists/Pass', 'Fantasy/Touch', 'FD Fantasy/Touch']
622
+ game_rot_cols = ['Pts', 'FGM', 'FGA', 'FG%', 'FG3M', 'FG3A', 'FG3%', 'FTM', 'FTA', 'FT%', 'REB', 'Assists', 'Stl', 'Blk', 'Tov', 'PF',
623
+ 'DD', 'TD', 'Fantasy', 'FD_Fantasy']
624
  indv_teams = gamelog_table.drop_duplicates(subset='Team')
625
  total_teams = indv_teams.Team.values.tolist()
626
  indv_rot_teams = rot_table.drop_duplicates(subset='Team')
 
666
  working_data = game_rot
667
  if game_rot_view == 'Player Rotations':
668
  display = st.container()
669
+ stats_disp = st.container()
670
  check_rotation = working_data[working_data['backlog_lookup'] == game_id_var]
671
  check_rotation = check_rotation.sort_values(by='Start', ascending=True)
672
+ game_rot_stats = check_rotation[[game_rot_cols]]
673
 
674
  fig = px.timeline(check_rotation, x_start="Start", x_end="Finish", y="Task", range_x=[0,check_rotation["Finish"].max()], text='minutes')
675
  fig.update_yaxes(autorange="reversed")
 
681
  fig.add_vline(x=36, line_width=3, line_dash="dash", line_color="green")
682
  # pages = pages.set_index('Player')
683
  display.plotly_chart(fig, use_container_width=True)
684
+ stats_disp.dataframe(game_rot_stats.style.format(precision=2), use_container_width = True)
685
 
686
  elif game_rot_view == 'Team Rotations':
687
  display = st.container()
688
+ stats_disp = st.container()
689
  check_rotation = working_data[working_data['backlog_lookup'] == game_id_var]
690
  check_rotation = check_rotation.sort_values(by='Start', ascending=True)
691
+ game_rot_stats = check_rotation[[game_rot_cols]]
692
 
693
  fig = px.timeline(check_rotation, x_start="Start", x_end="Finish", y="Task", range_x=[0,check_rotation["Finish"].max()], text='minutes')
694
  fig.update_yaxes(autorange="reversed")
 
699
  fig.add_vline(x=24, line_width=3, line_dash="dash", line_color="green")
700
  fig.add_vline(x=36, line_width=3, line_dash="dash", line_color="green")
701
  # pages = pages.set_index('Player')
702
+ display.plotly_chart(fig, use_container_width=True)
703
+ stats_disp.dataframe(game_rot_stats.style.format(precision=2), use_container_width = True)