James McCool
commited on
Commit
·
629cb6e
1
Parent(s):
8dfe988
Refactor player information mapping in app.py for consistency and clarity
Browse files- Updated the player information DataFrame to rename 'Display Name' to 'Player', ensuring consistent terminology across the codebase.
- Adjusted the construction of various dictionaries to utilize the new 'Player' column, enhancing readability and maintainability of the player data mappings.
- Maintained existing functionality while improving the clarity of player data handling during contest processing.
app.py
CHANGED
@@ -42,13 +42,14 @@ def grab_contest_player_info(db, sport, type, contest_name, contest_id_map):
|
|
42 |
|
43 |
player_info = pd.DataFrame(list(cursor)).drop('_id', axis=1)
|
44 |
player_info = player_info[player_info['Contest ID'] == contest_id_map[contest_name]]
|
|
|
45 |
|
46 |
info_maps = {
|
47 |
-
'position_dict': dict(zip(player_info['
|
48 |
-
'salary_dict': dict(zip(player_info['
|
49 |
-
'team_dict': dict(zip(player_info['
|
50 |
-
'opp_dict': dict(zip(player_info['
|
51 |
-
'fpts_avg_dict': dict(zip(player_info['
|
52 |
}
|
53 |
|
54 |
return player_info, info_maps
|
|
|
42 |
|
43 |
player_info = pd.DataFrame(list(cursor)).drop('_id', axis=1)
|
44 |
player_info = player_info[player_info['Contest ID'] == contest_id_map[contest_name]]
|
45 |
+
player_info = player_info.rename(columns={'Display Name': 'Player'})
|
46 |
|
47 |
info_maps = {
|
48 |
+
'position_dict': dict(zip(player_info['Player'], player_info['Position'])),
|
49 |
+
'salary_dict': dict(zip(player_info['Player'], player_info['Salary'])),
|
50 |
+
'team_dict': dict(zip(player_info['Player'], player_info['Team'])),
|
51 |
+
'opp_dict': dict(zip(player_info['Player'], player_info['Opp'])),
|
52 |
+
'fpts_avg_dict': dict(zip(player_info['Player'], player_info['Avg FPTS']))
|
53 |
}
|
54 |
|
55 |
return player_info, info_maps
|