James McCool
commited on
Commit
·
51ae6c5
1
Parent(s):
25fcef5
Refactor trimming options in app.py: encapsulate trimming selections within a form for better user interaction, and update the submission button for clarity in the trimming process.
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ import pandas as pd
|
|
5 |
import time
|
6 |
from fuzzywuzzy import process
|
7 |
import random
|
|
|
8 |
|
9 |
## import global functions
|
10 |
from global_func.clean_player_name import clean_player_name
|
@@ -801,11 +802,13 @@ with tab3:
|
|
801 |
|
802 |
submitted = st.form_submit_button("Submit")
|
803 |
with st.expander('Trimming Options'):
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
st.session_state['portfolio'] = trim_portfolio(st.session_state['portfolio'], performance_type, own_type)
|
808 |
|
|
|
|
|
809 |
with col2:
|
810 |
st.session_state['portfolio'] = predict_dupes(st.session_state['portfolio'], map_dict, site_var, type_var, Contest_Size, strength_var)
|
811 |
st.session_state['portfolio'] = st.session_state['portfolio'][st.session_state['portfolio']['Dupes'] <= max_dupes]
|
|
|
5 |
import time
|
6 |
from fuzzywuzzy import process
|
7 |
import random
|
8 |
+
from scipy.stats import gmean
|
9 |
|
10 |
## import global functions
|
11 |
from global_func.clean_player_name import clean_player_name
|
|
|
802 |
|
803 |
submitted = st.form_submit_button("Submit")
|
804 |
with st.expander('Trimming Options'):
|
805 |
+
with st.form(key='trim_form'):
|
806 |
+
performance_type = st.selectbox("Select sort type", ['median', 'Finish_percentile'])
|
807 |
+
own_type = st.selectbox("Select trimming variable type", ['Own', 'Geomean'])
|
808 |
st.session_state['portfolio'] = trim_portfolio(st.session_state['portfolio'], performance_type, own_type)
|
809 |
|
810 |
+
submitted = st.form_submit_button("Trim")
|
811 |
+
|
812 |
with col2:
|
813 |
st.session_state['portfolio'] = predict_dupes(st.session_state['portfolio'], map_dict, site_var, type_var, Contest_Size, strength_var)
|
814 |
st.session_state['portfolio'] = st.session_state['portfolio'][st.session_state['portfolio']['Dupes'] <= max_dupes]
|