Spaces:
Build error
Build error
James McCool
commited on
Commit
·
63ad7ef
1
Parent(s):
7a1b6ea
Update Streamlit app to sort display frames for both 'Basics' and 'Exclude DFS Info' options, improving data presentation by prioritizing key metrics in the displayed data.
Browse files- src/streamlit_app.py +3 -2
src/streamlit_app.py
CHANGED
|
@@ -33,12 +33,13 @@ disp_options = st.radio("Display options:", options = ['Basics', 'Exclude DFS In
|
|
| 33 |
if disp_options == 'Basics':
|
| 34 |
st.session_state['disp_frame'] = hr_frame[['Player', 'xHR/PA', 'Opp_xHR/PA', 'BP_Binom_xHR', 'Binom_xHR']]
|
| 35 |
st.session_state['disp_frame'] = st.session_state['disp_frame'].rename(columns={'xHR/PA': 'Hitter', 'Opp_xHR/PA': 'SP', 'BP_Binom_xHR': 'BP', 'Binom_xHR': 'xHRs'})
|
|
|
|
| 36 |
elif disp_options == 'Exclude DFS Info':
|
| 37 |
st.session_state['disp_frame'] = hr_frame.drop(columns=['Salary', 'Position', 'FD_Position', 'Order'])
|
|
|
|
| 38 |
else:
|
| 39 |
st.session_state['disp_frame'] = hr_frame.copy()
|
| 40 |
-
|
| 41 |
-
st.session_state['disp_frame'] = st.session_state['disp_frame'].sort_values(by='Binom_xHR', ascending=False)
|
| 42 |
|
| 43 |
if 'disp_frame' in st.session_state:
|
| 44 |
st.dataframe(st.session_state['disp_frame'].style.background_gradient(axis=0).background_gradient(cmap = 'RdYlGn').format(precision=2), height=1200, use_container_width = True, hide_index = True)
|
|
|
|
| 33 |
if disp_options == 'Basics':
|
| 34 |
st.session_state['disp_frame'] = hr_frame[['Player', 'xHR/PA', 'Opp_xHR/PA', 'BP_Binom_xHR', 'Binom_xHR']]
|
| 35 |
st.session_state['disp_frame'] = st.session_state['disp_frame'].rename(columns={'xHR/PA': 'Hitter', 'Opp_xHR/PA': 'SP', 'BP_Binom_xHR': 'BP', 'Binom_xHR': 'xHRs'})
|
| 36 |
+
st.session_state['disp_frame'] = st.session_state['disp_frame'].sort_values(by='xHRs', ascending=False)
|
| 37 |
elif disp_options == 'Exclude DFS Info':
|
| 38 |
st.session_state['disp_frame'] = hr_frame.drop(columns=['Salary', 'Position', 'FD_Position', 'Order'])
|
| 39 |
+
st.session_state['disp_frame'] = st.session_state['disp_frame'].sort_values(by='Binom_xHR', ascending=False)
|
| 40 |
else:
|
| 41 |
st.session_state['disp_frame'] = hr_frame.copy()
|
| 42 |
+
st.session_state['disp_frame'] = st.session_state['disp_frame'].sort_values(by='Binom_xHR', ascending=False)
|
|
|
|
| 43 |
|
| 44 |
if 'disp_frame' in st.session_state:
|
| 45 |
st.dataframe(st.session_state['disp_frame'].style.background_gradient(axis=0).background_gradient(cmap = 'RdYlGn').format(precision=2), height=1200, use_container_width = True, hide_index = True)
|