James McCool commited on
Commit
38762a9
·
1 Parent(s): 735eb51

Implement conditional data export logic in app.py: enhance the data export functionality by incorporating slate type (Regular or Showdown) for both Draftkings and Fanduel, ensuring accurate player ID mapping and improving data handling during export.

Browse files
Files changed (1) hide show
  1. app.py +19 -5
app.py CHANGED
@@ -420,13 +420,27 @@ with tab2:
420
  elif player_var1 == 'Full Slate':
421
  player_var2 = fd_raw.Player.values.tolist()
422
  if st.button("Prepare data export", key='data_export'):
423
- data_export = st.session_state.working_seed.copy()
424
  if site_var1 == 'Draftkings':
425
- for col_idx in range(8):
426
- data_export[:, col_idx] = np.array([id_dict.get(player, player) for player in data_export[:, col_idx]])
 
 
 
 
 
 
 
427
  elif site_var1 == 'Fanduel':
428
- for col_idx in range(9):
429
- data_export[:, col_idx] = np.array([id_dict.get(player, player) for player in data_export[:, col_idx]])
 
 
 
 
 
 
 
430
  st.download_button(
431
  label="Export optimals set",
432
  data=convert_df(data_export),
 
420
  elif player_var1 == 'Full Slate':
421
  player_var2 = fd_raw.Player.values.tolist()
422
  if st.button("Prepare data export", key='data_export'):
423
+
424
  if site_var1 == 'Draftkings':
425
+ if slate_type_var1 == 'Regular':
426
+ data_export = init_DK_lineups(slate_var1)
427
+ for col_idx in range(8):
428
+ data_export[:, col_idx] = np.array([id_dict.get(player, player) for player in data_export[:, col_idx]])
429
+ elif slate_type_var1 == 'Showdown':
430
+ data_export = init_DK_SD_lineups(slate_var1)
431
+ for col_idx in range(5):
432
+ data_export[:, col_idx] = np.array([id_dict_sd.get(player, player) for player in data_export[:, col_idx]])
433
+
434
  elif site_var1 == 'Fanduel':
435
+ if slate_type_var1 == 'Regular':
436
+ data_export = init_FD_lineups(slate_var1)
437
+ for col_idx in range(9):
438
+ data_export[:, col_idx] = np.array([id_dict.get(player, player) for player in data_export[:, col_idx]])
439
+ elif slate_type_var1 == 'Showdown':
440
+ data_export = init_FD_SD_lineups(slate_var1)
441
+ for col_idx in range(5):
442
+ data_export[:, col_idx] = np.array([id_dict_sd.get(player, player) for player in data_export[:, col_idx]])
443
+
444
  st.download_button(
445
  label="Export optimals set",
446
  data=convert_df(data_export),