Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -219,14 +219,14 @@ with tab1:
|
|
219 |
st.session_state.working_seed = st.session_state.working_seed[np.isin(st.session_state.working_seed[:, 12], stack_var2)]
|
220 |
st.session_state.data_export_display = pd.DataFrame(st.session_state.working_seed[0:1000], columns=column_names)
|
221 |
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
|
231 |
with tab2:
|
232 |
col1, col2 = st.columns([1, 7])
|
@@ -355,81 +355,7 @@ with tab2:
|
|
355 |
columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
|
356 |
st.session_state.stack_freq['Freq'] = st.session_state.stack_freq['Freq'].astype(int)
|
357 |
st.session_state.stack_freq['Exposure'] = st.session_state.stack_freq['Freq']/(1000)
|
358 |
-
|
359 |
-
with st.container():
|
360 |
-
try:
|
361 |
-
st.dataframe(st.session_state.Sim_Winner_Frame)
|
362 |
-
except:
|
363 |
-
st.write("resources low, waiting 5 seconds and trying again")
|
364 |
-
time.sleep(5)
|
365 |
-
st.dataframe(st.session_state.Sim_Winner_Frame)
|
366 |
|
367 |
-
with st.container():
|
368 |
-
tab1, tab2, tab3, tab4 = st.tabs(['Overall Exposures', 'SP Exposures', 'Team Exposures', 'Stack Size Exposures'])
|
369 |
-
with tab1:
|
370 |
-
if 'player_freq' in st.session_state:
|
371 |
-
|
372 |
-
try:
|
373 |
-
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)
|
374 |
-
except:
|
375 |
-
st.write("resources low, waiting 5 seconds and trying again")
|
376 |
-
time.sleep(5)
|
377 |
-
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)
|
378 |
-
st.download_button(
|
379 |
-
label="Export Exposures",
|
380 |
-
data=st.session_state.player_freq.to_csv().encode('utf-8'),
|
381 |
-
file_name='player_freq_export.csv',
|
382 |
-
mime='text/csv',
|
383 |
-
key='overall'
|
384 |
-
)
|
385 |
-
with tab2:
|
386 |
-
if 'sp_freq' in st.session_state:
|
387 |
-
|
388 |
-
try:
|
389 |
-
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)
|
390 |
-
except:
|
391 |
-
st.write("resources low, waiting 5 seconds and trying again")
|
392 |
-
time.sleep(5)
|
393 |
-
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)
|
394 |
-
st.download_button(
|
395 |
-
label="Export Exposures",
|
396 |
-
data=st.session_state.sp_freq.to_csv().encode('utf-8'),
|
397 |
-
file_name='sp_freq.csv',
|
398 |
-
mime='text/csv',
|
399 |
-
key='sp'
|
400 |
-
)
|
401 |
-
with tab3:
|
402 |
-
if 'team_freq' in st.session_state:
|
403 |
-
|
404 |
-
try:
|
405 |
-
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)
|
406 |
-
except:
|
407 |
-
st.write("resources low, waiting 5 seconds and trying again")
|
408 |
-
time.sleep(5)
|
409 |
-
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)
|
410 |
-
st.download_button(
|
411 |
-
label="Export Exposures",
|
412 |
-
data=st.session_state.team_freq.to_csv().encode('utf-8'),
|
413 |
-
file_name='team_freq.csv',
|
414 |
-
mime='text/csv',
|
415 |
-
key='team'
|
416 |
-
)
|
417 |
-
with tab4:
|
418 |
-
if 'stack_freq' in st.session_state:
|
419 |
-
|
420 |
-
try:
|
421 |
-
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)
|
422 |
-
except:
|
423 |
-
st.write("resources low, waiting 5 seconds and trying again")
|
424 |
-
time.sleep(5)
|
425 |
-
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)
|
426 |
-
st.download_button(
|
427 |
-
label="Export Exposures",
|
428 |
-
data=st.session_state.stack_freq.to_csv().encode('utf-8'),
|
429 |
-
file_name='stack_freq.csv',
|
430 |
-
mime='text/csv',
|
431 |
-
key='stack'
|
432 |
-
)
|
433 |
else:
|
434 |
if sim_site_var1 == 'Draftkings':
|
435 |
st.session_state.working_seed = DK_seed.copy()
|
@@ -519,77 +445,52 @@ with tab2:
|
|
519 |
st.session_state.stack_freq['Freq'] = st.session_state.stack_freq['Freq'].astype(int)
|
520 |
st.session_state.stack_freq['Exposure'] = st.session_state.stack_freq['Freq']/(1000)
|
521 |
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
time.sleep(5)
|
572 |
-
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)
|
573 |
-
st.download_button(
|
574 |
-
label="Export Exposures",
|
575 |
-
data=st.session_state.team_freq.to_csv().encode('utf-8'),
|
576 |
-
file_name='team_freq.csv',
|
577 |
-
mime='text/csv',
|
578 |
-
key='team'
|
579 |
-
)
|
580 |
-
with tab4:
|
581 |
-
if 'stack_freq' in st.session_state:
|
582 |
-
|
583 |
-
try:
|
584 |
-
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)
|
585 |
-
except:
|
586 |
-
st.write("resources low, waiting 5 seconds and trying again")
|
587 |
-
time.sleep(5)
|
588 |
-
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)
|
589 |
-
st.download_button(
|
590 |
-
label="Export Exposures",
|
591 |
-
data=st.session_state.stack_freq.to_csv().encode('utf-8'),
|
592 |
-
file_name='stack_freq.csv',
|
593 |
-
mime='text/csv',
|
594 |
-
key='stack'
|
595 |
-
)
|
|
|
219 |
st.session_state.working_seed = st.session_state.working_seed[np.isin(st.session_state.working_seed[:, 12], stack_var2)]
|
220 |
st.session_state.data_export_display = pd.DataFrame(st.session_state.working_seed[0:1000], columns=column_names)
|
221 |
|
222 |
+
with st.container():
|
223 |
+
if 'data_export_display' in st.session_state:
|
224 |
+
try:
|
225 |
+
st.table(st.session_state.data_export_display)
|
226 |
+
except:
|
227 |
+
st.write("resources low, waiting 5 seconds and trying again")
|
228 |
+
time.sleep(5)
|
229 |
+
st.table(st.session_state.data_export_display)
|
230 |
|
231 |
with tab2:
|
232 |
col1, col2 = st.columns([1, 7])
|
|
|
355 |
columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
|
356 |
st.session_state.stack_freq['Freq'] = st.session_state.stack_freq['Freq'].astype(int)
|
357 |
st.session_state.stack_freq['Exposure'] = st.session_state.stack_freq['Freq']/(1000)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
358 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
359 |
else:
|
360 |
if sim_site_var1 == 'Draftkings':
|
361 |
st.session_state.working_seed = DK_seed.copy()
|
|
|
445 |
st.session_state.stack_freq['Freq'] = st.session_state.stack_freq['Freq'].astype(int)
|
446 |
st.session_state.stack_freq['Exposure'] = st.session_state.stack_freq['Freq']/(1000)
|
447 |
|
448 |
+
with st.container():
|
449 |
+
st.dataframe(st.session_state.Sim_Winner_Frame)
|
450 |
+
|
451 |
+
with st.container():
|
452 |
+
tab1, tab2, tab3, tab4 = st.tabs(['Overall Exposures', 'SP Exposures', 'Team Exposures', 'Stack Size Exposures'])
|
453 |
+
with tab1:
|
454 |
+
if 'player_freq' in st.session_state:
|
455 |
+
|
456 |
+
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)
|
457 |
+
st.download_button(
|
458 |
+
label="Export Exposures",
|
459 |
+
data=st.session_state.player_freq.to_csv().encode('utf-8'),
|
460 |
+
file_name='player_freq_export.csv',
|
461 |
+
mime='text/csv',
|
462 |
+
key='overall'
|
463 |
+
)
|
464 |
+
with tab2:
|
465 |
+
if 'sp_freq' in st.session_state:
|
466 |
+
|
467 |
+
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)
|
468 |
+
st.download_button(
|
469 |
+
label="Export Exposures",
|
470 |
+
data=st.session_state.sp_freq.to_csv().encode('utf-8'),
|
471 |
+
file_name='sp_freq.csv',
|
472 |
+
mime='text/csv',
|
473 |
+
key='sp'
|
474 |
+
)
|
475 |
+
with tab3:
|
476 |
+
if 'team_freq' in st.session_state:
|
477 |
+
|
478 |
+
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)
|
479 |
+
st.download_button(
|
480 |
+
label="Export Exposures",
|
481 |
+
data=st.session_state.team_freq.to_csv().encode('utf-8'),
|
482 |
+
file_name='team_freq.csv',
|
483 |
+
mime='text/csv',
|
484 |
+
key='team'
|
485 |
+
)
|
486 |
+
with tab4:
|
487 |
+
if 'stack_freq' in st.session_state:
|
488 |
+
|
489 |
+
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)
|
490 |
+
st.download_button(
|
491 |
+
label="Export Exposures",
|
492 |
+
data=st.session_state.stack_freq.to_csv().encode('utf-8'),
|
493 |
+
file_name='stack_freq.csv',
|
494 |
+
mime='text/csv',
|
495 |
+
key='stack'
|
496 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|