nesticot commited on
Commit
db329f6
·
verified ·
1 Parent(s): 1ebf57c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -119,12 +119,20 @@ Filter and sort tjStuff+ Data for all MLB Pitchers
119
  # Create a selectbox widget for pitch types
120
  selected_pitch_types = st.selectbox('Select Pitch Types *(leave blank for all pitch types)*', unique_pitch_types)
121
 
 
 
 
 
122
  # Filter the DataFrame based on selected pitch types
123
  if selected_pitch_types == 'All':
124
  df = df.filter(pl.col('pitch_type') == 'All').sort('tj_stuff_plus', descending=True)
125
  elif selected_pitch_types != '':
126
  df = df.filter(pl.col('pitch_type') == dict_pitch_desc_type[selected_pitch_types]).sort('tj_stuff_plus', descending=True)
127
 
 
 
 
 
128
  # Convert Polars DataFrame to Pandas DataFrame and apply styling
129
  styled_df = df[['pitcher_id', 'pitcher_name', 'pitch_type', 'pitches', 'tj_stuff_plus', 'pitch_grade']].to_pandas().style
130
 
 
119
  # Create a selectbox widget for pitch types
120
  selected_pitch_types = st.selectbox('Select Pitch Types *(leave blank for all pitch types)*', unique_pitch_types)
121
 
122
+ # Create a selectbox widget for position
123
+ selected_position = st.selectbox('Select Position *(leave blank for all Pitchers)*', ['','SP','RP'])
124
+
125
+
126
  # Filter the DataFrame based on selected pitch types
127
  if selected_pitch_types == 'All':
128
  df = df.filter(pl.col('pitch_type') == 'All').sort('tj_stuff_plus', descending=True)
129
  elif selected_pitch_types != '':
130
  df = df.filter(pl.col('pitch_type') == dict_pitch_desc_type[selected_pitch_types]).sort('tj_stuff_plus', descending=True)
131
 
132
+ if selected_pitch_types != '':
133
+ df = df.filter(pl.col('position') == selected_position).sort('tj_stuff_plus', descending=True)
134
+
135
+
136
  # Convert Polars DataFrame to Pandas DataFrame and apply styling
137
  styled_df = df[['pitcher_id', 'pitcher_name', 'pitch_type', 'pitches', 'tj_stuff_plus', 'pitch_grade']].to_pandas().style
138