Spaces:
Running
Running
James McCool
commited on
Commit
·
2e150af
1
Parent(s):
2e3a8c0
Enhance app.py: Add view mode selector and improve data display options
Browse files- Introduce a new "View" radio button to toggle between "Simple" and "Advanced" display modes
- Modify column selection based on view mode for Full Slate and Showdown types
- Remove duplicate players from display to ensure unique entries
- Simplify data presentation with flexible view options
app.py
CHANGED
@@ -122,22 +122,38 @@ with tab1:
|
|
122 |
del st.session_state[key]
|
123 |
|
124 |
st.write(timestamp)
|
|
|
125 |
options_container = st.empty()
|
126 |
hold_container = st.empty()
|
127 |
|
128 |
with options_container:
|
129 |
-
col1, col2 = st.columns(
|
130 |
with col1:
|
131 |
-
|
132 |
with col2:
|
133 |
-
|
134 |
-
|
|
|
135 |
with hold_container:
|
136 |
if type_var == "Full Slate":
|
137 |
display = hold_display[hold_display['Site'] == site_var]
|
|
|
138 |
elif type_var == "Showdown":
|
139 |
display = sd_roo_data
|
140 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
|
142 |
st.download_button(
|
143 |
label="Export Projections",
|
|
|
122 |
del st.session_state[key]
|
123 |
|
124 |
st.write(timestamp)
|
125 |
+
info_container = st.empty()
|
126 |
options_container = st.empty()
|
127 |
hold_container = st.empty()
|
128 |
|
129 |
with options_container:
|
130 |
+
col1, col2, col3 = st.columns(3)
|
131 |
with col1:
|
132 |
+
view_var = st.radio("Select a View", ["Simple", "Advanced"])
|
133 |
with col2:
|
134 |
+
site_var = st.radio("Select a Site", ["Draftkings", "FanDuel"])
|
135 |
+
with col3:
|
136 |
+
type_var = st.radio("Select a Type", ["Full Slate", "Showdown"])
|
137 |
with hold_container:
|
138 |
if type_var == "Full Slate":
|
139 |
display = hold_display[hold_display['Site'] == site_var]
|
140 |
+
display = display.drop_duplicates(subset=['Player'])
|
141 |
elif type_var == "Showdown":
|
142 |
display = sd_roo_data
|
143 |
+
display = display.drop_duplicates(subset=['Player'])
|
144 |
+
|
145 |
+
if view_var == "Simple":
|
146 |
+
if type_var == "Full Slate":
|
147 |
+
display = display[['Player', 'Salary', 'Median', '10x%', 'Own']]
|
148 |
+
display = display.set_index('Player')
|
149 |
+
elif type_var == "Showdown":
|
150 |
+
display = display[['Player', 'Salary', 'Median', '5x%', 'Own']]
|
151 |
+
display = display.set_index('Player')
|
152 |
+
st.dataframe(display.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(player_roo_format, precision=2), height=750, use_container_width = True)
|
153 |
+
elif view_var == "Advanced":
|
154 |
+
display = display
|
155 |
+
display = display.set_index('Player')
|
156 |
+
st.dataframe(display.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(player_roo_format, precision=2), height=750, use_container_width = True)
|
157 |
|
158 |
st.download_button(
|
159 |
label="Export Projections",
|