Spaces:
Running
Running
James McCool
commited on
Commit
·
96799c9
1
Parent(s):
3f36e0d
Enhance tab styling and move display options into an expander
Browse files
app.py
CHANGED
@@ -55,6 +55,37 @@ fd_columns = ['PG1', 'PG2', 'SG1', 'SG2', 'SF1', 'SF2', 'PF1', 'PF2', 'C1', 'sal
|
|
55 |
|
56 |
roo_format = {'Top_finish': '{:.2%}', 'Top_5_finish': '{:.2%}', 'Top_10_finish': '{:.2%}', '20+%': '{:.2%}', '4x%': '{:.2%}', '5x%': '{:.2%}', '6x%': '{:.2%}', 'GPP%': '{:.2%}'}
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
@st.cache_data(ttl=60)
|
59 |
def load_overall_stats():
|
60 |
collection = db["DK_Player_Stats"]
|
@@ -299,56 +330,56 @@ with tab1:
|
|
299 |
for key in st.session_state.keys():
|
300 |
del st.session_state[key]
|
301 |
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
335 |
else:
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
team_var2 = raw_baselines.Team.values.tolist()
|
345 |
-
|
346 |
-
pos_var2 = st.selectbox('Position Filter', options=['All', 'PG', 'SG', 'SF', 'PF', 'C'], key='pos_var2')
|
347 |
-
col1, col2 = st.columns(2)
|
348 |
-
with col1:
|
349 |
-
low_salary = st.number_input('Enter Lowest Salary', min_value=3000, max_value=15000, value=3000, step=100, key='low_salary')
|
350 |
-
with col2:
|
351 |
-
high_salary = st.number_input('Enter Highest Salary', min_value=3000, max_value=15000, value=15000, step=100, key='high_salary')
|
352 |
|
353 |
display_container_1 = st.empty()
|
354 |
display_dl_container_1 = st.empty()
|
|
|
55 |
|
56 |
roo_format = {'Top_finish': '{:.2%}', 'Top_5_finish': '{:.2%}', 'Top_10_finish': '{:.2%}', '20+%': '{:.2%}', '4x%': '{:.2%}', '5x%': '{:.2%}', '6x%': '{:.2%}', 'GPP%': '{:.2%}'}
|
57 |
|
58 |
+
st.markdown("""
|
59 |
+
<style>
|
60 |
+
/* Tab styling */
|
61 |
+
.stTabs [data-baseweb="tab-list"] {
|
62 |
+
gap: 8px;
|
63 |
+
padding: 4px;
|
64 |
+
}
|
65 |
+
|
66 |
+
.stTabs [data-baseweb="tab"] {
|
67 |
+
height: 50px;
|
68 |
+
white-space: pre-wrap;
|
69 |
+
background-color: #FFD700;
|
70 |
+
color: white;
|
71 |
+
border-radius: 10px;
|
72 |
+
gap: 1px;
|
73 |
+
padding: 10px 20px;
|
74 |
+
font-weight: bold;
|
75 |
+
transition: all 0.3s ease;
|
76 |
+
}
|
77 |
+
|
78 |
+
.stTabs [aria-selected="true"] {
|
79 |
+
background-color: #DAA520;
|
80 |
+
color: white;
|
81 |
+
}
|
82 |
+
|
83 |
+
.stTabs [data-baseweb="tab"]:hover {
|
84 |
+
background-color: #DAA520;
|
85 |
+
cursor: pointer;
|
86 |
+
}
|
87 |
+
</style>""", unsafe_allow_html=True)
|
88 |
+
|
89 |
@st.cache_data(ttl=60)
|
90 |
def load_overall_stats():
|
91 |
collection = db["DK_Player_Stats"]
|
|
|
330 |
for key in st.session_state.keys():
|
331 |
del st.session_state[key]
|
332 |
|
333 |
+
with st.expander("Display Options"):
|
334 |
+
col1, col2, col3, col4 = st.columns(4)
|
335 |
+
with col1:
|
336 |
+
view_var2 = st.radio("View Type", ('Simple', 'Advanced'), key='view_var2')
|
337 |
+
with col2:
|
338 |
+
site_var2 = st.radio("Site", ('Draftkings', 'Fanduel'), key='site_var2')
|
339 |
+
|
340 |
+
# Process site selection
|
341 |
+
if site_var2 == 'Draftkings':
|
342 |
+
site_baselines = roo_raw[roo_raw['site'] == 'Draftkings']
|
343 |
+
site_backlog = roo_backlog[roo_backlog['site'] == 'Draftkings']
|
344 |
+
elif site_var2 == 'Fanduel':
|
345 |
+
site_baselines = roo_raw[roo_raw['site'] == 'Fanduel']
|
346 |
+
site_backlog = roo_backlog[roo_backlog['site'] == 'Fanduel']
|
347 |
+
with col3:
|
348 |
+
slate_split = st.radio("Slate Type", ('Main Slate', 'Secondary', 'Backlog'), key='slate_split')
|
349 |
+
|
350 |
+
if slate_split == 'Main Slate':
|
351 |
+
raw_baselines = site_baselines[site_baselines['slate'] == 'Main Slate']
|
352 |
+
elif slate_split == 'Secondary':
|
353 |
+
raw_baselines = site_baselines[site_baselines['slate'] == 'Secondary Slate']
|
354 |
+
elif slate_split == 'Backlog':
|
355 |
+
raw_baselines = site_backlog
|
356 |
+
# Third row - backlog options
|
357 |
+
col1, col2 = st.columns(2)
|
358 |
+
with col1:
|
359 |
+
view_all = st.checkbox("View all dates?", key='view_all')
|
360 |
+
with col2:
|
361 |
+
if not view_all:
|
362 |
+
date_var2 = st.date_input("Select date", key='date_var2')
|
363 |
+
|
364 |
+
if view_all:
|
365 |
+
raw_baselines = raw_baselines.sort_values(by=['Median', 'Date'], ascending=[False, False])
|
366 |
+
else:
|
367 |
+
raw_baselines = raw_baselines[raw_baselines['Date'] == date_var2.strftime('%m-%d-%Y')]
|
368 |
+
raw_baselines = raw_baselines.sort_values(by='Median', ascending=False)
|
369 |
+
|
370 |
+
with col4:
|
371 |
+
split_var2 = st.radio("Slate Range", ('Full Slate Run', 'Specific Games'), key='split_var2')
|
372 |
+
if split_var2 == 'Specific Games':
|
373 |
+
team_var2 = st.multiselect('Select teams for ROO', options=raw_baselines['Team'].unique(), key='team_var2')
|
374 |
else:
|
375 |
+
team_var2 = raw_baselines.Team.values.tolist()
|
376 |
+
|
377 |
+
pos_var2 = st.selectbox('Position Filter', options=['All', 'PG', 'SG', 'SF', 'PF', 'C'], key='pos_var2')
|
378 |
+
col1, col2 = st.columns(2)
|
379 |
+
with col1:
|
380 |
+
low_salary = st.number_input('Enter Lowest Salary', min_value=3000, max_value=15000, value=3000, step=100, key='low_salary')
|
381 |
+
with col2:
|
382 |
+
high_salary = st.number_input('Enter Highest Salary', min_value=3000, max_value=15000, value=15000, step=100, key='high_salary')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
383 |
|
384 |
display_container_1 = st.empty()
|
385 |
display_dl_container_1 = st.empty()
|