James McCool commited on
Commit
b206444
·
1 Parent(s): ae5a3d1

Refactor app.py to adjust column layout for the "Load/Reset Data" button and replace forms with containers for Scoring Percentages, Player ROO, and Optimals sections, improving UI structure and simplifying user interactions.

Browse files
Files changed (1) hide show
  1. app.py +12 -15
app.py CHANGED
@@ -118,19 +118,16 @@ def convert_df(array):
118
  array = pd.DataFrame(array, columns=column_names)
119
  return array.to_csv().encode('utf-8')
120
 
121
- col1, col2 = st.columns([3, 3])
122
  with col1:
123
- with st.container():
124
- col = st.columns(3)[0] # Create 3 columns and use middle one
125
- with col:
126
- if st.button("Load/Reset Data", key='reset'):
127
- st.cache_data.clear()
128
- roo_data, sd_roo_data, scoring_percentages = init_baselines()
129
- hold_display = roo_data
130
- dk_lineups = init_DK_lineups('Main')
131
- fd_lineups = init_FD_lineups('Main')
132
- for key in st.session_state.keys():
133
- del st.session_state[key]
134
  with col2:
135
  with st.form("Data Load"):
136
  col1, col2 = st.columns([3, 3])
@@ -149,7 +146,7 @@ hold_display = roo_data
149
  with tab1:
150
  st.header("Scoring Percentages")
151
  with st.expander("Info and Filters"):
152
- with st.form("Scoring Percentages"):
153
  slate_var1 = st.radio("Which data are you loading?", ('Main Slate', 'Secondary Slate', 'All Games'))
154
  own_var1 = st.radio("How would you like to display team ownership?", ('Sum', 'Average'))
155
  submit_button = st.form_submit_button("Submit")
@@ -163,7 +160,7 @@ with tab1:
163
  with tab2:
164
  st.header("Player ROO")
165
  with st.expander("Info and Filters"):
166
- with st.form("Player ROO"):
167
  slate_type_var2 = st.radio("Which slate type are you loading?", ('Regular', 'Showdown'))
168
  slate_var2 = st.radio("Which slate data are you loading?", ('Main', 'Secondary', 'Auxiliary'))
169
  pos_var2 = st.radio("Which position group would you like to view?", ('All', 'Pitchers', 'Hitters'))
@@ -212,7 +209,7 @@ with tab2:
212
  with tab3:
213
  st.header("Optimals")
214
  with st.expander("Info and Filters"):
215
- with st.form("Optimals"):
216
  slate_type_var3 = st.radio("Which slate type are you loading?", ('Regular', 'Showdown'))
217
  slate_var3 = st.radio("Which slate data are you loading?", ('Main', 'Secondary', 'Auxiliary'))
218
  submit_button = st.form_submit_button("Submit")
 
118
  array = pd.DataFrame(array, columns=column_names)
119
  return array.to_csv().encode('utf-8')
120
 
121
+ col1, col2 = st.columns([1, 9])
122
  with col1:
123
+ if st.button("Load/Reset Data", key='reset'):
124
+ st.cache_data.clear()
125
+ roo_data, sd_roo_data, scoring_percentages = init_baselines()
126
+ hold_display = roo_data
127
+ dk_lineups = init_DK_lineups('Main')
128
+ fd_lineups = init_FD_lineups('Main')
129
+ for key in st.session_state.keys():
130
+ del st.session_state[key]
 
 
 
131
  with col2:
132
  with st.form("Data Load"):
133
  col1, col2 = st.columns([3, 3])
 
146
  with tab1:
147
  st.header("Scoring Percentages")
148
  with st.expander("Info and Filters"):
149
+ with st.container():
150
  slate_var1 = st.radio("Which data are you loading?", ('Main Slate', 'Secondary Slate', 'All Games'))
151
  own_var1 = st.radio("How would you like to display team ownership?", ('Sum', 'Average'))
152
  submit_button = st.form_submit_button("Submit")
 
160
  with tab2:
161
  st.header("Player ROO")
162
  with st.expander("Info and Filters"):
163
+ with st.container():
164
  slate_type_var2 = st.radio("Which slate type are you loading?", ('Regular', 'Showdown'))
165
  slate_var2 = st.radio("Which slate data are you loading?", ('Main', 'Secondary', 'Auxiliary'))
166
  pos_var2 = st.radio("Which position group would you like to view?", ('All', 'Pitchers', 'Hitters'))
 
209
  with tab3:
210
  st.header("Optimals")
211
  with st.expander("Info and Filters"):
212
+ with st.container():
213
  slate_type_var3 = st.radio("Which slate type are you loading?", ('Regular', 'Showdown'))
214
  slate_var3 = st.radio("Which slate data are you loading?", ('Main', 'Secondary', 'Auxiliary'))
215
  submit_button = st.form_submit_button("Submit")