Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -225,9 +225,13 @@ with tab2:
|
|
225 |
sim_slate_var1 = st.radio("Which data are you loading?", ('Main Slate', 'Other Main Slate'), key='sim_slate_var1')
|
226 |
sim_site_var1 = st.radio("What site are you working with?", ('Draftkings', 'Fanduel'), key='sim_site_var1')
|
227 |
if sim_site_var1 == 'Draftkings':
|
|
|
|
|
228 |
raw_baselines = dk_raw
|
229 |
column_names = dk_columns
|
230 |
elif sim_site_var1 == 'Fanduel':
|
|
|
|
|
231 |
raw_baselines = fd_raw
|
232 |
column_names = fd_columns
|
233 |
|
@@ -341,13 +345,24 @@ with tab2:
|
|
341 |
st.session_state.stack_freq['Exposure'] = st.session_state.stack_freq['Freq']/(1000)
|
342 |
|
343 |
with st.container():
|
344 |
-
|
|
|
|
|
|
|
|
|
|
|
345 |
|
346 |
with st.container():
|
347 |
tab1, tab2, tab3, tab4 = st.tabs(['Overall Exposures', 'SP Exposures', 'Team Exposures', 'Stack Size Exposures'])
|
348 |
with tab1:
|
349 |
if 'player_freq' in st.session_state:
|
350 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
351 |
st.download_button(
|
352 |
label="Export Exposures",
|
353 |
data=st.session_state.player_freq.to_csv().encode('utf-8'),
|
@@ -357,31 +372,49 @@ with tab2:
|
|
357 |
)
|
358 |
with tab2:
|
359 |
if 'sp_freq' in st.session_state:
|
360 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
361 |
st.download_button(
|
362 |
label="Export Exposures",
|
363 |
data=st.session_state.sp_freq.to_csv().encode('utf-8'),
|
364 |
-
file_name='
|
365 |
mime='text/csv',
|
366 |
key='sp'
|
367 |
)
|
368 |
with tab3:
|
369 |
if 'team_freq' in st.session_state:
|
370 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
371 |
st.download_button(
|
372 |
label="Export Exposures",
|
373 |
data=st.session_state.team_freq.to_csv().encode('utf-8'),
|
374 |
-
file_name='
|
375 |
mime='text/csv',
|
376 |
key='team'
|
377 |
)
|
378 |
with tab4:
|
379 |
if 'stack_freq' in st.session_state:
|
380 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
381 |
st.download_button(
|
382 |
label="Export Exposures",
|
383 |
data=st.session_state.stack_freq.to_csv().encode('utf-8'),
|
384 |
-
file_name='
|
385 |
mime='text/csv',
|
386 |
key='stack'
|
387 |
)
|
@@ -486,6 +519,7 @@ with tab2:
|
|
486 |
tab1, tab2, tab3, tab4 = st.tabs(['Overall Exposures', 'SP Exposures', 'Team Exposures', 'Stack Size Exposures'])
|
487 |
with tab1:
|
488 |
if 'player_freq' in st.session_state:
|
|
|
489 |
try:
|
490 |
st.dataframe(st.session_state.player_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(freq_format, precision=2), use_container_width = True)
|
491 |
except:
|
@@ -501,6 +535,7 @@ with tab2:
|
|
501 |
)
|
502 |
with tab2:
|
503 |
if 'sp_freq' in st.session_state:
|
|
|
504 |
try:
|
505 |
st.dataframe(st.session_state.sp_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(freq_format, precision=2), use_container_width = True)
|
506 |
except:
|
@@ -516,6 +551,7 @@ with tab2:
|
|
516 |
)
|
517 |
with tab3:
|
518 |
if 'team_freq' in st.session_state:
|
|
|
519 |
try:
|
520 |
st.dataframe(st.session_state.team_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(percentages_format, precision=2), use_container_width = True)
|
521 |
except:
|
@@ -531,6 +567,7 @@ with tab2:
|
|
531 |
)
|
532 |
with tab4:
|
533 |
if 'stack_freq' in st.session_state:
|
|
|
534 |
try:
|
535 |
st.dataframe(st.session_state.stack_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(percentages_format, precision=2), use_container_width = True)
|
536 |
except:
|
|
|
225 |
sim_slate_var1 = st.radio("Which data are you loading?", ('Main Slate', 'Other Main Slate'), key='sim_slate_var1')
|
226 |
sim_site_var1 = st.radio("What site are you working with?", ('Draftkings', 'Fanduel'), key='sim_site_var1')
|
227 |
if sim_site_var1 == 'Draftkings':
|
228 |
+
for key in st.session_state.keys():
|
229 |
+
del st.session_state[key]
|
230 |
raw_baselines = dk_raw
|
231 |
column_names = dk_columns
|
232 |
elif sim_site_var1 == 'Fanduel':
|
233 |
+
for key in st.session_state.keys():
|
234 |
+
del st.session_state[key]
|
235 |
raw_baselines = fd_raw
|
236 |
column_names = fd_columns
|
237 |
|
|
|
345 |
st.session_state.stack_freq['Exposure'] = st.session_state.stack_freq['Freq']/(1000)
|
346 |
|
347 |
with st.container():
|
348 |
+
try:
|
349 |
+
st.dataframe(st.session_state.Sim_Winner_Frame)
|
350 |
+
except:
|
351 |
+
st.write("resources low, waiting 5 seconds and trying again")
|
352 |
+
time.sleep(5)
|
353 |
+
st.dataframe(st.session_state.Sim_Winner_Frame)
|
354 |
|
355 |
with st.container():
|
356 |
tab1, tab2, tab3, tab4 = st.tabs(['Overall Exposures', 'SP Exposures', 'Team Exposures', 'Stack Size Exposures'])
|
357 |
with tab1:
|
358 |
if 'player_freq' in st.session_state:
|
359 |
+
|
360 |
+
try:
|
361 |
+
st.dataframe(st.session_state.player_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(freq_format, precision=2), use_container_width = True)
|
362 |
+
except:
|
363 |
+
st.write("resources low, waiting 5 seconds and trying again")
|
364 |
+
time.sleep(5)
|
365 |
+
st.dataframe(st.session_state.player_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(freq_format, precision=2), use_container_width = True)
|
366 |
st.download_button(
|
367 |
label="Export Exposures",
|
368 |
data=st.session_state.player_freq.to_csv().encode('utf-8'),
|
|
|
372 |
)
|
373 |
with tab2:
|
374 |
if 'sp_freq' in st.session_state:
|
375 |
+
|
376 |
+
try:
|
377 |
+
st.dataframe(st.session_state.sp_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(freq_format, precision=2), use_container_width = True)
|
378 |
+
except:
|
379 |
+
st.write("resources low, waiting 5 seconds and trying again")
|
380 |
+
time.sleep(5)
|
381 |
+
st.dataframe(st.session_state.sp_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(freq_format, precision=2), use_container_width = True)
|
382 |
st.download_button(
|
383 |
label="Export Exposures",
|
384 |
data=st.session_state.sp_freq.to_csv().encode('utf-8'),
|
385 |
+
file_name='sp_freq.csv',
|
386 |
mime='text/csv',
|
387 |
key='sp'
|
388 |
)
|
389 |
with tab3:
|
390 |
if 'team_freq' in st.session_state:
|
391 |
+
|
392 |
+
try:
|
393 |
+
st.dataframe(st.session_state.team_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(percentages_format, precision=2), use_container_width = True)
|
394 |
+
except:
|
395 |
+
st.write("resources low, waiting 5 seconds and trying again")
|
396 |
+
time.sleep(5)
|
397 |
+
st.dataframe(st.session_state.team_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(percentages_format, precision=2), use_container_width = True)
|
398 |
st.download_button(
|
399 |
label="Export Exposures",
|
400 |
data=st.session_state.team_freq.to_csv().encode('utf-8'),
|
401 |
+
file_name='team_freq.csv',
|
402 |
mime='text/csv',
|
403 |
key='team'
|
404 |
)
|
405 |
with tab4:
|
406 |
if 'stack_freq' in st.session_state:
|
407 |
+
|
408 |
+
try:
|
409 |
+
st.dataframe(st.session_state.stack_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(percentages_format, precision=2), use_container_width = True)
|
410 |
+
except:
|
411 |
+
st.write("resources low, waiting 5 seconds and trying again")
|
412 |
+
time.sleep(5)
|
413 |
+
st.dataframe(st.session_state.stack_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(percentages_format, precision=2), use_container_width = True)
|
414 |
st.download_button(
|
415 |
label="Export Exposures",
|
416 |
data=st.session_state.stack_freq.to_csv().encode('utf-8'),
|
417 |
+
file_name='stack_freq.csv',
|
418 |
mime='text/csv',
|
419 |
key='stack'
|
420 |
)
|
|
|
519 |
tab1, tab2, tab3, tab4 = st.tabs(['Overall Exposures', 'SP Exposures', 'Team Exposures', 'Stack Size Exposures'])
|
520 |
with tab1:
|
521 |
if 'player_freq' in st.session_state:
|
522 |
+
|
523 |
try:
|
524 |
st.dataframe(st.session_state.player_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(freq_format, precision=2), use_container_width = True)
|
525 |
except:
|
|
|
535 |
)
|
536 |
with tab2:
|
537 |
if 'sp_freq' in st.session_state:
|
538 |
+
|
539 |
try:
|
540 |
st.dataframe(st.session_state.sp_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(freq_format, precision=2), use_container_width = True)
|
541 |
except:
|
|
|
551 |
)
|
552 |
with tab3:
|
553 |
if 'team_freq' in st.session_state:
|
554 |
+
|
555 |
try:
|
556 |
st.dataframe(st.session_state.team_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(percentages_format, precision=2), use_container_width = True)
|
557 |
except:
|
|
|
567 |
)
|
568 |
with tab4:
|
569 |
if 'stack_freq' in st.session_state:
|
570 |
+
|
571 |
try:
|
572 |
st.dataframe(st.session_state.stack_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(percentages_format, precision=2), use_container_width = True)
|
573 |
except:
|