Multichem commited on
Commit
81a9d39
·
1 Parent(s): 58a1366

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -16
app.py CHANGED
@@ -230,6 +230,8 @@ 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')
232
  total_rot_teams = indv_rot_teams.Team.values.tolist()
 
 
233
  indv_players = gamelog_table.drop_duplicates(subset='Player')
234
  total_players = indv_players.Player.values.tolist()
235
  total_dates = gamelog_table.Date.values.tolist()
@@ -257,6 +259,8 @@ with tab1:
257
  total_teams = indv_teams.Team.values.tolist()
258
  indv_rot_teams = rot_table.drop_duplicates(subset='Team')
259
  total_rot_teams = indv_rot_teams.Team.values.tolist()
 
 
260
  indv_players = gamelog_table.drop_duplicates(subset='Player')
261
  total_players = indv_players.Player.values.tolist()
262
  total_dates = gamelog_table.Date.values.tolist()
@@ -382,6 +386,8 @@ with tab2:
382
  total_teams = indv_teams.Team.values.tolist()
383
  indv_rot_teams = rot_table.drop_duplicates(subset='Team')
384
  total_rot_teams = indv_rot_teams.Team.values.tolist()
 
 
385
  indv_players = gamelog_table.drop_duplicates(subset='Player')
386
  total_players = indv_players.Player.values.tolist()
387
  total_dates = gamelog_table.Date.values.tolist()
@@ -473,6 +479,8 @@ with tab3:
473
  total_teams = indv_teams.Team.values.tolist()
474
  indv_rot_teams = rot_table.drop_duplicates(subset='Team')
475
  total_rot_teams = indv_rot_teams.Team.values.tolist()
 
 
476
  indv_players = gamelog_table.drop_duplicates(subset='Player')
477
  total_players = indv_players.Player.values.tolist()
478
  total_dates = gamelog_table.Date.values.tolist()
@@ -556,6 +564,8 @@ with tab4:
556
  total_teams = indv_teams.Team.values.tolist()
557
  indv_rot_teams = rot_table.drop_duplicates(subset='Team')
558
  total_rot_teams = indv_rot_teams.Team.values.tolist()
 
 
559
  indv_players = gamelog_table.drop_duplicates(subset='Player')
560
  total_players = indv_players.Player.values.tolist()
561
  total_dates = gamelog_table.Date.values.tolist()
@@ -584,7 +594,7 @@ with tab4:
584
 
585
  with tab5:
586
  st.info(t_stamp)
587
- col1, col2 = st.columns([1, 9])
588
  with col1:
589
  if st.button("Reset Data", key='reset5'):
590
  st.cache_data.clear()
@@ -613,9 +623,6 @@ with tab5:
613
 
614
  if game_rot_view == 'Team Rotations':
615
  game_rot_team = st.selectbox("What team would you like to work with?", options = total_game_rot_teams, key='game_rot_team')
616
- team_backlog = game_rot[game_rot['TEAM_ABBREVIATION'] == game_rot_team]
617
-
618
- game_id_var = st.selectbox("What game would you like to view?", options = team_backlog['backlog_lookup'], key='game_id_var')
619
 
620
  game_rot_spread = st.slider("Is there a certain spread range you want to view?", 0, 100, (0, 100), key='game_rot_spread')
621
 
@@ -633,19 +640,23 @@ with tab5:
633
  elif game_rot_dates == 'All':
634
  game_rot_low_date = gamelog_table['Date'].min()
635
  game_rot_high_date = gamelog_table['Date'].max()
 
 
636
 
637
 
638
 
639
  with col2:
 
 
 
 
 
 
 
 
640
  working_data = game_rot
641
  if game_rot_view == 'Player Rotations':
642
  display = st.container()
643
- working_data = working_data[working_data['GAME_DATE'] >= game_rot_low_date]
644
- working_data = working_data[working_data['GAME_DATE'] <= game_rot_high_date]
645
- working_data = working_data[working_data['MIN'] >= game_rot_min[0]]
646
- working_data = working_data[working_data['MIN'] <= game_rot_min[1]]
647
- working_data = working_data[working_data['spread'] >= game_rot_spread[0]]
648
- working_data = working_data[working_data['spread'] <= game_rot_spread[1]]
649
  check_rotation = working_data[working_data['backlog_lookup'] == game_id_var]
650
 
651
  fig = px.timeline(check_rotation, x_start="Start", x_end="Finish", y="Task", range_x=[0,check_rotation["Finish"].max()], text='minutes')
@@ -661,12 +672,6 @@ with tab5:
661
 
662
  elif game_rot_view == 'Team Rotations':
663
  display = st.container()
664
- working_data = working_data[working_data['GAME_DATE'] >= game_rot_low_date]
665
- working_data = working_data[working_data['GAME_DATE'] <= game_rot_high_date]
666
- working_data = working_data[working_data['MIN'] >= game_rot_min[0]]
667
- working_data = working_data[working_data['MIN'] <= game_rot_min[1]]
668
- working_data = working_data[working_data['spread'] >= game_rot_spread[0]]
669
- working_data = working_data[working_data['spread'] <= game_rot_spread[1]]
670
  check_rotation = working_data[working_data['backlog_lookup'] == game_id_var]
671
 
672
  fig = px.timeline(check_rotation, x_start="Start", x_end="Finish", y="Task", range_x=[0,check_rotation["Finish"].max()], text='minutes')
 
230
  total_teams = indv_teams.Team.values.tolist()
231
  indv_rot_teams = rot_table.drop_duplicates(subset='Team')
232
  total_rot_teams = indv_rot_teams.Team.values.tolist()
233
+ indv_game_rot_teams = game_rot.drop_duplicates(subset='TEAM_ABBREVIATION')
234
+ total_game_rot_teams = indv_game_rot_teams.TEAM_ABBREVIATION.values.tolist()
235
  indv_players = gamelog_table.drop_duplicates(subset='Player')
236
  total_players = indv_players.Player.values.tolist()
237
  total_dates = gamelog_table.Date.values.tolist()
 
259
  total_teams = indv_teams.Team.values.tolist()
260
  indv_rot_teams = rot_table.drop_duplicates(subset='Team')
261
  total_rot_teams = indv_rot_teams.Team.values.tolist()
262
+ indv_game_rot_teams = game_rot.drop_duplicates(subset='TEAM_ABBREVIATION')
263
+ total_game_rot_teams = indv_game_rot_teams.TEAM_ABBREVIATION.values.tolist()
264
  indv_players = gamelog_table.drop_duplicates(subset='Player')
265
  total_players = indv_players.Player.values.tolist()
266
  total_dates = gamelog_table.Date.values.tolist()
 
386
  total_teams = indv_teams.Team.values.tolist()
387
  indv_rot_teams = rot_table.drop_duplicates(subset='Team')
388
  total_rot_teams = indv_rot_teams.Team.values.tolist()
389
+ indv_game_rot_teams = game_rot.drop_duplicates(subset='TEAM_ABBREVIATION')
390
+ total_game_rot_teams = indv_game_rot_teams.TEAM_ABBREVIATION.values.tolist()
391
  indv_players = gamelog_table.drop_duplicates(subset='Player')
392
  total_players = indv_players.Player.values.tolist()
393
  total_dates = gamelog_table.Date.values.tolist()
 
479
  total_teams = indv_teams.Team.values.tolist()
480
  indv_rot_teams = rot_table.drop_duplicates(subset='Team')
481
  total_rot_teams = indv_rot_teams.Team.values.tolist()
482
+ indv_game_rot_teams = game_rot.drop_duplicates(subset='TEAM_ABBREVIATION')
483
+ total_game_rot_teams = indv_game_rot_teams.TEAM_ABBREVIATION.values.tolist()
484
  indv_players = gamelog_table.drop_duplicates(subset='Player')
485
  total_players = indv_players.Player.values.tolist()
486
  total_dates = gamelog_table.Date.values.tolist()
 
564
  total_teams = indv_teams.Team.values.tolist()
565
  indv_rot_teams = rot_table.drop_duplicates(subset='Team')
566
  total_rot_teams = indv_rot_teams.Team.values.tolist()
567
+ indv_game_rot_teams = game_rot.drop_duplicates(subset='TEAM_ABBREVIATION')
568
+ total_game_rot_teams = indv_game_rot_teams.TEAM_ABBREVIATION.values.tolist()
569
  indv_players = gamelog_table.drop_duplicates(subset='Player')
570
  total_players = indv_players.Player.values.tolist()
571
  total_dates = gamelog_table.Date.values.tolist()
 
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()
 
623
 
624
  if game_rot_view == 'Team Rotations':
625
  game_rot_team = st.selectbox("What team would you like to work with?", options = total_game_rot_teams, key='game_rot_team')
 
 
 
626
 
627
  game_rot_spread = st.slider("Is there a certain spread range you want to view?", 0, 100, (0, 100), key='game_rot_spread')
628
 
 
640
  elif game_rot_dates == 'All':
641
  game_rot_low_date = gamelog_table['Date'].min()
642
  game_rot_high_date = gamelog_table['Date'].max()
643
+
644
+
645
 
646
 
647
 
648
  with col2:
649
+ team_backlog = game_rot[game_rot['TEAM_ABBREVIATION'] == game_rot_team]
650
+ team_backlog = team_backlog[team_backlog['GAME_DATE'] >= game_rot_low_date]
651
+ team_backlog = team_backlog[team_backlog['GAME_DATE'] <= game_rot_high_date]
652
+ team_backlog = team_backlog[team_backlog['MIN'] >= game_rot_min[0]]
653
+ team_backlog = team_backlog[team_backlog['MIN'] <= game_rot_min[1]]
654
+ team_backlog = team_backlog[team_backlog['spread'] >= game_rot_spread[0]]
655
+ team_backlog = team_backlog[team_backlog['spread'] <= game_rot_spread[1]]
656
+ game_id_var = st.selectbox("What game would you like to view?", options = team_backlog['backlog_lookup'], key='game_id_var')
657
  working_data = game_rot
658
  if game_rot_view == 'Player Rotations':
659
  display = st.container()
 
 
 
 
 
 
660
  check_rotation = working_data[working_data['backlog_lookup'] == game_id_var]
661
 
662
  fig = px.timeline(check_rotation, x_start="Start", x_end="Finish", y="Task", range_x=[0,check_rotation["Finish"].max()], text='minutes')
 
672
 
673
  elif game_rot_view == 'Team Rotations':
674
  display = st.container()
 
 
 
 
 
 
675
  check_rotation = working_data[working_data['backlog_lookup'] == game_id_var]
676
 
677
  fig = px.timeline(check_rotation, x_start="Start", x_end="Finish", y="Task", range_x=[0,check_rotation["Finish"].max()], text='minutes')