James McCool commited on
Commit
e344b74
·
1 Parent(s): a6b5d03

Enhance FD seed frame initialization in app.py by adding a mapping for player names using a dictionary from the database. This improves data readability and ensures that player names are correctly displayed in the output DataFrame.

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -46,13 +46,21 @@ def init_DK_Secondary_seed_frames(sharp_split):
46
  return DK_seed
47
 
48
  @st.cache_data(ttl = 599)
49
- def init_FD_seed_frames(sharp_split):
 
 
 
 
50
 
51
  collection = db["FD_NFL_seed_frame"]
52
  cursor = collection.find().limit(sharp_split)
53
 
54
  raw_display = pd.DataFrame(list(cursor))
55
  raw_display = raw_display[['QB', 'RB1', 'RB2', 'WR1', 'WR2', 'WR3', 'TE', 'FLEX', 'DST', 'salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own']]
 
 
 
 
56
  FD_seed = raw_display.to_numpy()
57
 
58
  return FD_seed
 
46
  return DK_seed
47
 
48
  @st.cache_data(ttl = 599)
49
+ def init_FD_seed_frames(sharp_split):
50
+
51
+ collection = db['FD_NFL_name_map']
52
+ cursor = collection.find()
53
+ names_dict = dict(cursor)
54
 
55
  collection = db["FD_NFL_seed_frame"]
56
  cursor = collection.find().limit(sharp_split)
57
 
58
  raw_display = pd.DataFrame(list(cursor))
59
  raw_display = raw_display[['QB', 'RB1', 'RB2', 'WR1', 'WR2', 'WR3', 'TE', 'FLEX', 'DST', 'salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own']]
60
+ dict_columns = ['QB', 'RB1', 'RB2', 'WR1', 'WR2', 'WR3', 'TE', 'FLEX', 'DST']
61
+ st.write("converting names")
62
+ for col in dict_columns:
63
+ raw_display[col] = raw_display[col].map(names_dict)
64
  FD_seed = raw_display.to_numpy()
65
 
66
  return FD_seed