James McCool
commited on
Commit
·
82d3e88
1
Parent(s):
17c9148
Enhance preset selection in app.py: add a dropdown for choosing presets and update lineup target input label, improving user experience and interaction. Update small_field_preset function to filter working portfolio based on Finish_percentile, ensuring more accurate portfolio adjustments.
Browse files- app.py +10 -2
- global_func/small_field_preset.py +2 -1
app.py
CHANGED
@@ -1103,10 +1103,18 @@ with tab2:
|
|
1103 |
st.session_state['export_merge'] = st.session_state['working_frame'].copy()
|
1104 |
with st.expander('Presets'):
|
1105 |
with st.form(key='Small Field Preset'):
|
1106 |
-
|
|
|
1107 |
submitted = st.form_submit_button("Submit")
|
1108 |
if submitted:
|
1109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1110 |
st.session_state['working_frame'] = parsed_frame.sort_values(by='Own', ascending=False)
|
1111 |
st.session_state['export_merge'] = st.session_state['working_frame'].copy()
|
1112 |
|
|
|
1103 |
st.session_state['export_merge'] = st.session_state['working_frame'].copy()
|
1104 |
with st.expander('Presets'):
|
1105 |
with st.form(key='Small Field Preset'):
|
1106 |
+
preset_choice = st.selectbox("Preset", options=['Small Field', 'Large Field', 'Volatile', 'Distributed'], index=0)
|
1107 |
+
lineup_target = st.number_input("Lineups to produce", value=150, min_value=1, step=1)
|
1108 |
submitted = st.form_submit_button("Submit")
|
1109 |
if submitted:
|
1110 |
+
if preset_choice == 'Small Field':
|
1111 |
+
parsed_frame = small_field_preset(st.session_state['working_frame'], lineup_target)
|
1112 |
+
# elif preset_choice == 'Large Field':
|
1113 |
+
# parsed_frame = large_field_preset(st.session_state['working_frame'], lineup_target)
|
1114 |
+
# elif preset_choice == 'Volatile':
|
1115 |
+
# parsed_frame = volatile_preset(st.session_state['working_frame'], lineup_target)
|
1116 |
+
# elif preset_choice == 'Distributed':
|
1117 |
+
# parsed_frame = distributed_preset(st.session_state['working_frame'], lineup_target)
|
1118 |
st.session_state['working_frame'] = parsed_frame.sort_values(by='Own', ascending=False)
|
1119 |
st.session_state['export_merge'] = st.session_state['working_frame'].copy()
|
1120 |
|
global_func/small_field_preset.py
CHANGED
@@ -3,8 +3,9 @@ import pandas as pd
|
|
3 |
def small_field_preset(portfolio: pd.DataFrame, lineup_target: int):
|
4 |
|
5 |
for slack_var in range(1, 10):
|
6 |
-
working_portfolio = portfolio.sort_values(by='Own', ascending = False).reset_index(drop=True)
|
7 |
rows_to_drop = []
|
|
|
|
|
8 |
curr_own_type_max = working_portfolio.loc[0, 'Weighted Own'] + (slack_var / 10 * working_portfolio.loc[0, 'Weighted Own'])
|
9 |
|
10 |
for i in range(1, len(working_portfolio)):
|
|
|
3 |
def small_field_preset(portfolio: pd.DataFrame, lineup_target: int):
|
4 |
|
5 |
for slack_var in range(1, 10):
|
|
|
6 |
rows_to_drop = []
|
7 |
+
working_portfolio = portfolio.sort_values(by='Own', ascending = False).reset_index(drop=True)
|
8 |
+
working_portfolio = working_portfolio[working_portfolio['Finish_percentile'] <= .10]
|
9 |
curr_own_type_max = working_portfolio.loc[0, 'Weighted Own'] + (slack_var / 10 * working_portfolio.loc[0, 'Weighted Own'])
|
10 |
|
11 |
for i in range(1, len(working_portfolio)):
|