James McCool
commited on
Commit
·
c9fd1e3
1
Parent(s):
053e7df
Refactor player information forms layout in app.py
Browse files- Updated the layout of player information forms to improve user experience by organizing the position selection and comparison forms into separate columns.
- Adjusted the data display for player exposure comparison to enhance clarity and visual representation of the data.
app.py
CHANGED
|
@@ -396,47 +396,49 @@ with tab2:
|
|
| 396 |
with st.container():
|
| 397 |
tab1, tab2, tab3, tab4, tab5 = st.tabs(['Player Used Info', 'Stack Used Info', 'Stack Size Info', 'General Info', 'Duplication Info'])
|
| 398 |
with tab1:
|
| 399 |
-
|
| 400 |
-
|
| 401 |
-
with
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
with
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
|
| 434 |
-
|
| 435 |
-
|
| 436 |
-
|
|
|
|
|
|
|
| 437 |
if comp_player_var == 'Yes':
|
| 438 |
player_exp_comp = create_player_comparison(st.session_state['display_contest_info'], st.session_state['player_columns'], comp_player_select)
|
| 439 |
-
st.dataframe(player_exp_comp.style.background_gradient(cmap='RdYlGn', axis=
|
| 440 |
else:
|
| 441 |
if st.session_state['entry_parse_var'] == 'All':
|
| 442 |
|
|
|
|
| 396 |
with st.container():
|
| 397 |
tab1, tab2, tab3, tab4, tab5 = st.tabs(['Player Used Info', 'Stack Used Info', 'Stack Size Info', 'General Info', 'Duplication Info'])
|
| 398 |
with tab1:
|
| 399 |
+
player_pos_form_col, player_comp_form_col = st.columns(2)
|
| 400 |
+
with player_pos_form_col:
|
| 401 |
+
with st.form(key='player_info_pos_form'):
|
| 402 |
+
col1, col2 = st.columns(2)
|
| 403 |
+
with col1:
|
| 404 |
+
pos_var = st.selectbox("Which position(s) would you like to view?", ['All', 'Specific'], key='pos_var')
|
| 405 |
+
with col2:
|
| 406 |
+
if sport_select == 'MLB':
|
| 407 |
+
pos_select = st.multiselect("Select your position(s)", ['P', 'C', '1B', '2B', '3B', 'SS', 'OF'], key='pos_select')
|
| 408 |
+
elif sport_select == 'NBA':
|
| 409 |
+
pos_select = st.multiselect("Select your position(s)", ['PG', 'SG', 'SF', 'PF', 'C'], key='pos_select')
|
| 410 |
+
elif sport_select == 'WNBA':
|
| 411 |
+
pos_select = st.multiselect("Select your position(s)", ['PG', 'SG', 'SF', 'PF'], key='pos_select')
|
| 412 |
+
elif sport_select == 'NFL':
|
| 413 |
+
pos_select = st.multiselect("Select your position(s)", ['QB', 'RB', 'WR', 'TE', 'DST'], key='pos_select')
|
| 414 |
+
elif sport_select == 'NHL':
|
| 415 |
+
pos_select = st.multiselect("Select your position(s)", ['W', 'C', 'D', 'G'], key='pos_select')
|
| 416 |
+
elif sport_select == 'MMA':
|
| 417 |
+
pos_select = st.multiselect("Select your position(s)", ['All the same position', 'So', 'Yeah', 'Idk'], key='pos_select')
|
| 418 |
+
elif sport_select == 'GOLF':
|
| 419 |
+
pos_select = st.multiselect("Select your position(s)", ['All the same position', 'So', 'Yeah', 'Idk'], key='pos_select')
|
| 420 |
+
submitted = st.form_submit_button("Submit")
|
| 421 |
+
if submitted:
|
| 422 |
+
if pos_var == 'Specific':
|
| 423 |
+
pos_select = pos_select
|
| 424 |
+
else:
|
| 425 |
+
pos_select = None
|
| 426 |
+
with player_comp_form_col:
|
| 427 |
+
with st.form(key='player_exp_comp_form'):
|
| 428 |
+
col1, col2 = st.columns(2)
|
| 429 |
+
with col1:
|
| 430 |
+
comp_player_var = st.selectbox("Would you like to compare with anyone?", ['No', 'Yes'], key='comp_player_var')
|
| 431 |
+
with col2:
|
| 432 |
+
comp_player_select = st.multiselect("Select players to compare with:", st.session_state['display_contest_info']['BaseName'].sort_values().unique(), key='comp_player_select')
|
| 433 |
+
submitted = st.form_submit_button("Submit")
|
| 434 |
+
if submitted:
|
| 435 |
+
if comp_player_var == 'No':
|
| 436 |
+
comp_player_select = None
|
| 437 |
+
else:
|
| 438 |
+
comp_player_select = comp_player_select
|
| 439 |
if comp_player_var == 'Yes':
|
| 440 |
player_exp_comp = create_player_comparison(st.session_state['display_contest_info'], st.session_state['player_columns'], comp_player_select)
|
| 441 |
+
st.dataframe(player_exp_comp.style.background_gradient(cmap='RdYlGn', axis=0).format(formatter='{:.2%}', subset=player_exp_comp.select_dtypes(include=['number']).columns), hide_index=True)
|
| 442 |
else:
|
| 443 |
if st.session_state['entry_parse_var'] == 'All':
|
| 444 |
|