Multichem commited on
Commit
0cf815a
·
1 Parent(s): ffa148f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -19
app.py CHANGED
@@ -331,8 +331,7 @@ with tab3:
331
  elif site_var1 == 'Fanduel':
332
  min_sal1 = st.number_input('Min Salary', min_value = 45000, max_value = 59900, value = 59000, step = 100, key='min_sal1')
333
  max_sal1 = st.number_input('Max Salary', min_value = 45000, max_value = 60000, value = 60000, step = 100, key='max_sal1')
334
- with col2:
335
-
336
  if contest_var1 == 'Small Field GPP':
337
  if site_var1 == 'Draftkings':
338
  ownframe = raw_baselines.copy()
@@ -432,14 +431,17 @@ with tab3:
432
  flex_proj['roster'] = 'FLEX'
433
 
434
  combo_file = pd.concat([cpt_proj, flex_proj], ignore_index=True)
 
 
435
 
436
- st.dataframe(display_baselines.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
437
- st.download_button(
438
- label="Export Projections",
439
- data=convert_df_to_csv(export_baselines),
440
- file_name='NFL_proj_export.csv',
441
- mime='text/csv',
442
- )
 
443
 
444
  with st.container():
445
  if 'portfolio' in st.session_state:
@@ -471,7 +473,7 @@ with tab3:
471
  x = 1
472
 
473
  with st.spinner('Wait for it...'):
474
- with optimize_container:
475
 
476
  while x <= linenum_var1:
477
  sorted_lineup = []
@@ -589,11 +591,6 @@ with tab3:
589
  lineup_final['Own'] = lineup_final['Names'].map(player_own)
590
  lineup_final.loc['Column_Total'] = lineup_final.sum(numeric_only=True, axis=0)
591
  lineup_final = lineup_final.reset_index(drop=True)
592
- # lineup_final = lineup_final.set_index('Names')
593
-
594
- with col2:
595
- with st.container():
596
- st.table(lineup_final)
597
 
598
  max_proj = total_proj
599
  max_own = total_own
@@ -635,7 +632,7 @@ with tab3:
635
 
636
  final_outcomes = portfolio
637
 
638
- player_freq = pd.DataFrame(np.column_stack(np.unique(portfolio.iloc[:,0:5].values, return_counts=True)),
639
  columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
640
  player_freq['Freq'] = player_freq['Freq'].astype(int)
641
  player_freq['Position'] = player_freq['Player'].map(player_pos)
@@ -713,6 +710,4 @@ with tab3:
713
 
714
  st.session_state.final_outcomes_export = final_outcomes_export.copy()
715
 
716
- st.session_state.player_freq = player_freq[['Player', 'Position', 'Team', 'Salary', 'Proj Own', 'Exposure']]
717
-
718
-
 
331
  elif site_var1 == 'Fanduel':
332
  min_sal1 = st.number_input('Min Salary', min_value = 45000, max_value = 59900, value = 59000, step = 100, key='min_sal1')
333
  max_sal1 = st.number_input('Max Salary', min_value = 45000, max_value = 60000, value = 60000, step = 100, key='max_sal1')
334
+
 
335
  if contest_var1 == 'Small Field GPP':
336
  if site_var1 == 'Draftkings':
337
  ownframe = raw_baselines.copy()
 
431
  flex_proj['roster'] = 'FLEX'
432
 
433
  combo_file = pd.concat([cpt_proj, flex_proj], ignore_index=True)
434
+
435
+ with col2:
436
 
437
+ with st.container():
438
+ st.dataframe(display_baselines.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
439
+ st.download_button(
440
+ label="Export Projections",
441
+ data=convert_df_to_csv(export_baselines),
442
+ file_name='NFL_proj_export.csv',
443
+ mime='text/csv',
444
+ )
445
 
446
  with st.container():
447
  if 'portfolio' in st.session_state:
 
473
  x = 1
474
 
475
  with st.spinner('Wait for it...'):
476
+ with st.container():
477
 
478
  while x <= linenum_var1:
479
  sorted_lineup = []
 
591
  lineup_final['Own'] = lineup_final['Names'].map(player_own)
592
  lineup_final.loc['Column_Total'] = lineup_final.sum(numeric_only=True, axis=0)
593
  lineup_final = lineup_final.reset_index(drop=True)
 
 
 
 
 
594
 
595
  max_proj = total_proj
596
  max_own = total_own
 
632
 
633
  final_outcomes = portfolio
634
 
635
+ player_freq = pd.DataFrame(np.column_stack(np.unique(st.session_state.portfolio.iloc[:,0:5].values, return_counts=True)),
636
  columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
637
  player_freq['Freq'] = player_freq['Freq'].astype(int)
638
  player_freq['Position'] = player_freq['Player'].map(player_pos)
 
710
 
711
  st.session_state.final_outcomes_export = final_outcomes_export.copy()
712
 
713
+ st.session_state.player_freq = player_freq[['Player', 'Position', 'Team', 'Salary', 'Proj Own', 'Exposure']]