James McCool commited on
Commit
8e78c15
·
1 Parent(s): 755d752

Refactor data retrieval in app.py to include specific columns for player statistics, lines, and power play data from MongoDB collections, improving data structure and usability.

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -31,14 +31,18 @@ def player_stat_table():
31
  collection = db["Player_Level_ROO"]
32
  cursor = collection.find()
33
  player_frame = pd.DataFrame(cursor)
 
 
34
 
35
  collection = db["Player_Lines_ROO"]
36
  cursor = collection.find()
37
  line_frame = pd.DataFrame(cursor)
 
38
 
39
  collection = db["Player_PowerPlay_ROO"]
40
  cursor = collection.find()
41
  pp_frame = pd.DataFrame(cursor)
 
42
 
43
  timestamp = player_frame['timestamp'].values[0]
44
 
 
31
  collection = db["Player_Level_ROO"]
32
  cursor = collection.find()
33
  player_frame = pd.DataFrame(cursor)
34
+ player_frame = player_frame[['Player', 'Position', 'Team', 'Opp', 'Salary', 'Floor', 'Median', 'Ceiling', 'Top_finish', 'Top_5_finish', 'Top_10_finish', '20+%', '2x%', '3x%', '4x%', 'Own',
35
+ 'Small Field Own%', 'Large Field Own%', 'Cash Own%', 'CPT_Own', 'Site', 'Type', 'Slate', 'player_id', 'timestamp']]
36
 
37
  collection = db["Player_Lines_ROO"]
38
  cursor = collection.find()
39
  line_frame = pd.DataFrame(cursor)
40
+ line_frame = line_frame[['Player', 'SK1', 'SK2', 'SK3', 'Salary', 'Floor', 'Median', 'Ceiling', 'Top_finish', 'Top_5_finish', 'Top_10_finish', '50+%', '2x%', '3x%', '4x%', 'Own', 'Site', 'Type', 'Slate']]
41
 
42
  collection = db["Player_PowerPlay_ROO"]
43
  cursor = collection.find()
44
  pp_frame = pd.DataFrame(cursor)
45
+ pp_frame = pp_frame[['Player', 'SK1', 'SK2', 'SK3', 'SK4', 'SK5', 'Salary', 'Floor', 'Median', 'Ceiling', 'Top_finish', 'Top_5_finish', 'Top_10_finish', '75+%', '2x%', '3x%', '4x%', 'Own', 'Site', 'Type', 'Slate']]
46
 
47
  timestamp = player_frame['timestamp'].values[0]
48