James McCool
commited on
Commit
·
9ca66f9
1
Parent(s):
8f402fd
Enhance team selection options in pitcher and hitter tabs of Streamlit app
Browse files- Added new selection options for viewing all teams or specific teams in both pitcher and hitter tabs.
- Implemented multiselect functionality for specific team selection, improving user interactivity and customization.
- Updated layout to accommodate additional columns for team selection, enhancing overall user experience.
- src/streamlit_app.py +17 -3
src/streamlit_app.py
CHANGED
@@ -99,13 +99,20 @@ pitcher_tab, hitter_tab, team_tab = st.tabs(['Pitchers', 'Hitters', 'Team'])
|
|
99 |
with pitcher_tab:
|
100 |
with st.container(border = True):
|
101 |
st.info('Note: Splits options are available for all baseline tables, they do not apply to True AVG, HWSr, or the Overview tables')
|
102 |
-
col1, col2, col3 = st.columns(
|
103 |
with col1:
|
104 |
site_var_sp = st.selectbox('Site', ['DraftKings', 'FanDuel'], key = 'site_var_sp')
|
105 |
with col2:
|
106 |
table_var_sp = st.selectbox('Table', ['True AVG Splits', 'HWSr Splits', 'Current Slate Overview', 'Active Baselines', 'League Aggregate Baselines', 'League Short Term Baselines', 'League Long Term Baselines'], key = 'table_var_sp')
|
107 |
with col3:
|
108 |
splits_var_sp = st.selectbox('Splits', ['RHH', 'LHH', 'Overall'], key = 'splits_var_sp')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
|
110 |
if table_var_sp == 'True AVG Splits':
|
111 |
disp_raw = true_avg_split
|
@@ -151,16 +158,23 @@ with pitcher_tab:
|
|
151 |
with hitter_tab:
|
152 |
with st.container(border = True):
|
153 |
st.info('Note: Splits options are available for all baseline tables')
|
154 |
-
col1, col2, col3 = st.columns(
|
155 |
with col1:
|
156 |
site_var_hitter = st.selectbox('Site', ['DraftKings', 'FanDuel'], key = 'site_var_hitter')
|
157 |
with col2:
|
158 |
table_var_hitter = st.selectbox('Table', ['Active Baselines', 'League Aggregate Baselines', 'League Short Term Baselines', 'League Long Term Baselines'], key = 'table_var_hitter')
|
159 |
with col3:
|
160 |
splits_var_hitter = st.selectbox('Splits', ['Overall', 'RHP', 'LHP'], key = 'splits_var_hitter')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
|
162 |
if table_var_hitter == 'Current Slate Overview':
|
163 |
-
st.session_state['hitter_disp_frame'] =
|
164 |
elif table_var_hitter == 'Active Baselines':
|
165 |
st.session_state['hitter_disp_frame'] = hitter_info
|
166 |
elif table_var_hitter == 'League Aggregate Baselines':
|
|
|
99 |
with pitcher_tab:
|
100 |
with st.container(border = True):
|
101 |
st.info('Note: Splits options are available for all baseline tables, they do not apply to True AVG, HWSr, or the Overview tables')
|
102 |
+
col1, col2, col3, col4, col5 = st.columns(5)
|
103 |
with col1:
|
104 |
site_var_sp = st.selectbox('Site', ['DraftKings', 'FanDuel'], key = 'site_var_sp')
|
105 |
with col2:
|
106 |
table_var_sp = st.selectbox('Table', ['True AVG Splits', 'HWSr Splits', 'Current Slate Overview', 'Active Baselines', 'League Aggregate Baselines', 'League Short Term Baselines', 'League Long Term Baselines'], key = 'table_var_sp')
|
107 |
with col3:
|
108 |
splits_var_sp = st.selectbox('Splits', ['RHH', 'LHH', 'Overall'], key = 'splits_var_sp')
|
109 |
+
with col4:
|
110 |
+
team_type_sp = st.selectbox('Do you want to view all teams or Specific ones?', ['All', 'Specific'], key = 'team_type_sp')
|
111 |
+
with col5:
|
112 |
+
if team_type_sp == 'Specific':
|
113 |
+
team_var_sp = st.multiselect('Select Teams', starting_pitchers['Team'].unique(), key = 'team_var_sp')
|
114 |
+
else:
|
115 |
+
st.write('All teams selected')
|
116 |
|
117 |
if table_var_sp == 'True AVG Splits':
|
118 |
disp_raw = true_avg_split
|
|
|
158 |
with hitter_tab:
|
159 |
with st.container(border = True):
|
160 |
st.info('Note: Splits options are available for all baseline tables')
|
161 |
+
col1, col2, col3, col4, col5 = st.columns(5)
|
162 |
with col1:
|
163 |
site_var_hitter = st.selectbox('Site', ['DraftKings', 'FanDuel'], key = 'site_var_hitter')
|
164 |
with col2:
|
165 |
table_var_hitter = st.selectbox('Table', ['Active Baselines', 'League Aggregate Baselines', 'League Short Term Baselines', 'League Long Term Baselines'], key = 'table_var_hitter')
|
166 |
with col3:
|
167 |
splits_var_hitter = st.selectbox('Splits', ['Overall', 'RHP', 'LHP'], key = 'splits_var_hitter')
|
168 |
+
with col4:
|
169 |
+
team_type_hitter = st.selectbox('Do you want to view all teams or Specific ones?', ['All', 'Specific'], key = 'team_type_hitter')
|
170 |
+
with col5:
|
171 |
+
if team_type_hitter == 'Specific':
|
172 |
+
team_var_hitter = st.multiselect('Select Teams', slate_hitters['Team'].unique(), key = 'team_var_hitter')
|
173 |
+
else:
|
174 |
+
st.write('All teams selected')
|
175 |
|
176 |
if table_var_hitter == 'Current Slate Overview':
|
177 |
+
st.session_state['hitter_disp_frame'] = slate_hitters
|
178 |
elif table_var_hitter == 'Active Baselines':
|
179 |
st.session_state['hitter_disp_frame'] = hitter_info
|
180 |
elif table_var_hitter == 'League Aggregate Baselines':
|