James McCool commited on
Commit
13857b8
·
1 Parent(s): 5ed7a1c

Enhance stack selection functionality in app.py: update stack inclusion and removal options for improved user control over lineup configurations.

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -967,9 +967,11 @@ with tab2:
967
  max_salary = st.number_input("Max acceptable salary?", value=100000, min_value=1000, step=100)
968
  max_finish_percentile = st.number_input("Max acceptable finish percentile?", value=.50, min_value=0.005, step=.001)
969
  min_lineup_edge = st.number_input("Min acceptable Lineup Edge?", value=-.5, min_value=-1.00, step=.001)
970
- if stack_dict is not None:
971
- stack_toggle = st.selectbox("Include specific stacks?", options=['All Stacks', 'Specific Stacks'], index=0)
972
  stack_selections = st.multiselect("If Specific Stacks, Which to include?", options=sorted(list(set(stack_dict.values()))), default=[])
 
 
973
  stack_remove = st.multiselect("If Specific Stacks, Which to remove?", options=sorted(list(set(stack_dict.values()))), default=[])
974
 
975
  submitted = st.form_submit_button("Submit")
@@ -980,13 +982,15 @@ with tab2:
980
  parsed_frame = parsed_frame[parsed_frame['salary'] <= max_salary]
981
  parsed_frame = parsed_frame[parsed_frame['Finish_percentile'] <= max_finish_percentile]
982
  parsed_frame = parsed_frame[parsed_frame['Lineup Edge'] >= min_lineup_edge]
983
- if stack_dict is not None:
984
- if stack_toggle == 'All Stacks':
985
  parsed_frame = parsed_frame
986
- parsed_frame = parsed_frame[~parsed_frame['Stack'].isin(stack_remove)]
987
  else:
988
  parsed_frame = parsed_frame[parsed_frame['Stack'].isin(stack_selections)]
 
989
  parsed_frame = parsed_frame[~parsed_frame['Stack'].isin(stack_remove)]
 
 
990
  st.session_state['working_frame'] = parsed_frame.sort_values(by='median', ascending=False)
991
  st.session_state['export_merge'] = st.session_state['working_frame'].copy()
992
 
 
967
  max_salary = st.number_input("Max acceptable salary?", value=100000, min_value=1000, step=100)
968
  max_finish_percentile = st.number_input("Max acceptable finish percentile?", value=.50, min_value=0.005, step=.001)
969
  min_lineup_edge = st.number_input("Min acceptable Lineup Edge?", value=-.5, min_value=-1.00, step=.001)
970
+ if 'Stack' in st.session_state['working_frame'].columns:
971
+ stack_include_toggle = st.selectbox("Include specific stacks?", options=['All Stacks', 'Specific Stacks'], index=0)
972
  stack_selections = st.multiselect("If Specific Stacks, Which to include?", options=sorted(list(set(stack_dict.values()))), default=[])
973
+
974
+ stack_remove_toggle = st.selectbox("Remove specific stacks?", options=['No', 'Yes'], index=0)
975
  stack_remove = st.multiselect("If Specific Stacks, Which to remove?", options=sorted(list(set(stack_dict.values()))), default=[])
976
 
977
  submitted = st.form_submit_button("Submit")
 
982
  parsed_frame = parsed_frame[parsed_frame['salary'] <= max_salary]
983
  parsed_frame = parsed_frame[parsed_frame['Finish_percentile'] <= max_finish_percentile]
984
  parsed_frame = parsed_frame[parsed_frame['Lineup Edge'] >= min_lineup_edge]
985
+ if 'Stack' in parsed_frame.columns:
986
+ if stack_include_toggle == 'All Stacks':
987
  parsed_frame = parsed_frame
 
988
  else:
989
  parsed_frame = parsed_frame[parsed_frame['Stack'].isin(stack_selections)]
990
+ if stack_remove_toggle == 'Yes':
991
  parsed_frame = parsed_frame[~parsed_frame['Stack'].isin(stack_remove)]
992
+ else:
993
+ parsed_frame = parsed_frame
994
  st.session_state['working_frame'] = parsed_frame.sort_values(by='median', ascending=False)
995
  st.session_state['export_merge'] = st.session_state['working_frame'].copy()
996