James McCool commited on
Commit
7bdc4c8
·
1 Parent(s): 297c202

Update player name reference in seed frame initialization functions

Browse files

Changed the player name reference from 'Name' to 'Player' in the seed frame initialization functions for DraftKings and FanDuel. This adjustment ensures consistency with the data structure and improves the accuracy of player data retrieval. Additionally, removed redundant player validation calls from the lineup processing section to streamline the code.

Files changed (1) hide show
  1. app.py +4 -9
app.py CHANGED
@@ -63,7 +63,7 @@ def init_DK_seed_frames(load_size):
63
  # Get the valid players from the Range of Outcomes collection
64
  collection = db["Player_Range_Of_Outcomes"]
65
  cursor = collection.find({"site": "Draftkings", "slate": "Main Slate"})
66
- valid_players = set(pd.DataFrame(list(cursor))['Name'].unique())
67
 
68
  collection = db["DK_NBA_seed_frame"]
69
  cursor = collection.find().limit(load_size)
@@ -94,7 +94,7 @@ def init_DK_secondary_seed_frames(load_size):
94
  # Get the valid players from the Range of Outcomes collection
95
  collection = db["Player_Range_Of_Outcomes"]
96
  cursor = collection.find({"site": "Draftkings", "slate": "Secondary Slate"})
97
- valid_players = set(pd.DataFrame(list(cursor))['Name'].unique())
98
 
99
  collection = db["DK_NBA_Secondary_seed_frame"]
100
  cursor = collection.find().limit(load_size)
@@ -125,7 +125,7 @@ def init_FD_seed_frames(load_size):
125
  # Get the valid players from the Range of Outcomes collection
126
  collection = db["Player_Range_Of_Outcomes"]
127
  cursor = collection.find({"site": "Fanduel", "slate": "Main Slate"})
128
- valid_players = set(pd.DataFrame(list(cursor))['Name'].unique())
129
 
130
  collection = db["FD_NBA_seed_frame"]
131
  cursor = collection.find().limit(load_size)
@@ -156,7 +156,7 @@ def init_FD_secondary_seed_frames(load_size):
156
  # Get the valid players from the Range of Outcomes collection
157
  collection = db["Player_Range_Of_Outcomes"]
158
  cursor = collection.find({"site": "Fanduel", "slate": "Secondary Slate"})
159
- valid_players = set(pd.DataFrame(list(cursor))['Name'].unique())
160
 
161
  collection = db["FD_NBA_Secondary_seed_frame"]
162
  cursor = collection.find().limit(load_size)
@@ -297,11 +297,6 @@ with tab1:
297
  dk_id_dict = dict(zip(dk_raw.Player, dk_raw.player_id))
298
  fd_id_dict = dict(zip(fd_raw.Player, fd_raw.player_id))
299
 
300
- DK_seed = validate_lineup_players(DK_seed, set(dk_raw.Player), ['PG', 'SG', 'SF', 'PF', 'C', 'G', 'F', 'FLEX'])
301
- FD_seed = validate_lineup_players(FD_seed, set(fd_raw.Player), ['PG1', 'PG2', 'SG1', 'SG2', 'SF1', 'SF2', 'PF1', 'PF2', 'C1'])
302
- DK_secondary = validate_lineup_players(DK_secondary, set(dk_secondary.Player), ['PG', 'SG', 'SF', 'PF', 'C', 'G', 'F', 'FLEX'])
303
- FD_secondary = validate_lineup_players(FD_secondary, set(fd_secondary.Player), ['PG1', 'PG2', 'SG1', 'SG2', 'SF1', 'SF2', 'PF1', 'PF2', 'C1'])
304
-
305
  sim_slate_var1 = st.radio("Which data are you loading?", ('Main Slate', 'Secondary Slate'), key='sim_slate_var1')
306
  sim_site_var1 = st.radio("What site are you working with?", ('Draftkings', 'Fanduel'), key='sim_site_var1')
307
 
 
63
  # Get the valid players from the Range of Outcomes collection
64
  collection = db["Player_Range_Of_Outcomes"]
65
  cursor = collection.find({"site": "Draftkings", "slate": "Main Slate"})
66
+ valid_players = set(pd.DataFrame(list(cursor))['Player'].unique())
67
 
68
  collection = db["DK_NBA_seed_frame"]
69
  cursor = collection.find().limit(load_size)
 
94
  # Get the valid players from the Range of Outcomes collection
95
  collection = db["Player_Range_Of_Outcomes"]
96
  cursor = collection.find({"site": "Draftkings", "slate": "Secondary Slate"})
97
+ valid_players = set(pd.DataFrame(list(cursor))['Player'].unique())
98
 
99
  collection = db["DK_NBA_Secondary_seed_frame"]
100
  cursor = collection.find().limit(load_size)
 
125
  # Get the valid players from the Range of Outcomes collection
126
  collection = db["Player_Range_Of_Outcomes"]
127
  cursor = collection.find({"site": "Fanduel", "slate": "Main Slate"})
128
+ valid_players = set(pd.DataFrame(list(cursor))['Player'].unique())
129
 
130
  collection = db["FD_NBA_seed_frame"]
131
  cursor = collection.find().limit(load_size)
 
156
  # Get the valid players from the Range of Outcomes collection
157
  collection = db["Player_Range_Of_Outcomes"]
158
  cursor = collection.find({"site": "Fanduel", "slate": "Secondary Slate"})
159
+ valid_players = set(pd.DataFrame(list(cursor))['Player'].unique())
160
 
161
  collection = db["FD_NBA_Secondary_seed_frame"]
162
  cursor = collection.find().limit(load_size)
 
297
  dk_id_dict = dict(zip(dk_raw.Player, dk_raw.player_id))
298
  fd_id_dict = dict(zip(fd_raw.Player, fd_raw.player_id))
299
 
 
 
 
 
 
300
  sim_slate_var1 = st.radio("Which data are you loading?", ('Main Slate', 'Secondary Slate'), key='sim_slate_var1')
301
  sim_site_var1 = st.radio("What site are you working with?", ('Draftkings', 'Fanduel'), key='sim_site_var1')
302