James McCool commited on
Commit
7c053d1
·
1 Parent(s): 4894b46

Enhance Gamelogs display with sorting and column selection

Browse files

Modify the Gamelogs tab to display a curated set of columns and sort the data by date in descending order. This update improves the readability and presentation of game log information, making it easier for users to review recent game performances.

Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -616,6 +616,9 @@ if st.button("Run"):
616
  else:
617
  st.session_state.team_data, st.session_state.opp_boost, st.session_state.results_dict, st.session_state.gamelogs = init_player_data(game_count, selected_players, selected_opponent, win_loss_settings, kill_predictions, death_predictions, start_date, end_date)
618
 
 
 
 
619
  st.session_state.player_summary = pd.DataFrame()
620
 
621
  for game_num in range(game_count):
@@ -777,7 +780,6 @@ with tab3:
777
  st.dataframe(st.session_state.opp_boost.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
778
 
779
  with tab4:
780
- if 'gamelogs' in st.session_state:
781
  st.subheader("Gamelogs")
782
- st.dataframe(st.session_state.gamelogs.head(100).style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
783
-
 
616
  else:
617
  st.session_state.team_data, st.session_state.opp_boost, st.session_state.results_dict, st.session_state.gamelogs = init_player_data(game_count, selected_players, selected_opponent, win_loss_settings, kill_predictions, death_predictions, start_date, end_date)
618
 
619
+ st.session_state.gamelogs_display = st.session_state.gamelogs[['date', 'league', 'teamname', 'Opponent', 'playername', 'position', 'result', 'kills', 'deaths', 'assists', 'total_cs', 'fantasy']]
620
+ st.session_state.gamelogs_display = st.session_state.gamelogs_display.sort_values(by = ['date'], ascending = False)
621
+ st.session_state.gamelogs_display = st.session_state.gamelogs_display.reset_index(drop = True)
622
  st.session_state.player_summary = pd.DataFrame()
623
 
624
  for game_num in range(game_count):
 
780
  st.dataframe(st.session_state.opp_boost.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
781
 
782
  with tab4:
783
+ if 'gamelogs_display' in st.session_state:
784
  st.subheader("Gamelogs")
785
+ st.dataframe(st.session_state.gamelogs_display.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)