nesticot commited on
Commit
8d95317
·
verified ·
1 Parent(s): f81e00d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -94,17 +94,19 @@ df_merge = df.merge(df_catch, on='play_id', how='right', suffixes=('', '_fielder
94
  # Format the 'catch_rate' column as a percentage
95
  df_merge['catch_rate'] = df_merge['catch_rate'].astype(float).apply(lambda x: f"{x:.2%}")
96
 
 
 
97
  # Use a container to control the width of the AgGrid display
98
  with st.container():
99
  st.write("### Fielder Data")
100
  # Configure the AgGrid options
101
- gb = GridOptionsBuilder.from_dataframe(df_merge[['batter_name', 'pitcher_name', 'name_display_first_last', 'event', 'out', 'wall', 'back', 'stars', 'distance', 'hang_time', 'catch_rate']])
102
  gb.configure_selection('single', use_checkbox=True)
103
  grid_options = gb.build()
104
 
105
  # Display the dataframe using AgGrid
106
  grid_response = AgGrid(
107
- df_merge[['batter_name', 'pitcher_name', 'name_display_first_last', 'event', 'out', 'wall', 'back', 'stars', 'distance', 'hang_time', 'catch_rate']],
108
  gridOptions=grid_options,
109
  update_mode=GridUpdateMode.SELECTION_CHANGED,
110
  height=300,
 
94
  # Format the 'catch_rate' column as a percentage
95
  df_merge['catch_rate'] = df_merge['catch_rate'].astype(float).apply(lambda x: f"{x:.2%}")
96
 
97
+ column_names = ['batter_name', 'pitcher_name', 'name_display_first_last', 'event', 'out', 'wall', 'back', 'stars', 'distance', 'hang_time', 'catch_rate']
98
+
99
  # Use a container to control the width of the AgGrid display
100
  with st.container():
101
  st.write("### Fielder Data")
102
  # Configure the AgGrid options
103
+ gb = GridOptionsBuilder.from_dataframe(df_merge[column_names])
104
  gb.configure_selection('single', use_checkbox=True)
105
  grid_options = gb.build()
106
 
107
  # Display the dataframe using AgGrid
108
  grid_response = AgGrid(
109
+ df_merge[column_names],
110
  gridOptions=grid_options,
111
  update_mode=GridUpdateMode.SELECTION_CHANGED,
112
  height=300,