James McCool
commited on
Commit
·
ec805d9
1
Parent(s):
36fb2fe
Refactor lineup data processing in grab_contest_data.py to improve regex replacement
Browse files- Updated the replacement method for 'Lineup' in the lineups DataFrame to remove regex usage, enhancing performance and clarity in data handling.
- This change aligns with ongoing efforts to streamline data processing functions and improve overall code maintainability.
global_func/grab_contest_data.py
CHANGED
@@ -65,7 +65,7 @@ def grab_contest_data(sport, contest_name, contest_id_map, contest_date_map):
|
|
65 |
lineups_df = lineups_df.rename(columns={'index': 'Rank', 'points': 'Points', 'entryNameList': 'EntryName', 'lineupHash': 'Lineup'})
|
66 |
lineups_df['EntryName'] = lineups_df['EntryName'] + ' (1/1)'
|
67 |
lineups_df['Lineup'] = lineups_df['Lineup'].apply(lambda x: format_lineup_string(x, position_inserts))
|
68 |
-
lineups_df['Lineup'] = lineups_df['Lineup'].replace(pid_map
|
69 |
lineups_df = lineups_df[['Rank', 'EntryId', 'EntryName', 'TimeRemaining', 'Points', 'Lineup']]
|
70 |
|
71 |
total_data = lineups_df.merge(players_df, how='left', left_index=True, right_index=True)
|
|
|
65 |
lineups_df = lineups_df.rename(columns={'index': 'Rank', 'points': 'Points', 'entryNameList': 'EntryName', 'lineupHash': 'Lineup'})
|
66 |
lineups_df['EntryName'] = lineups_df['EntryName'] + ' (1/1)'
|
67 |
lineups_df['Lineup'] = lineups_df['Lineup'].apply(lambda x: format_lineup_string(x, position_inserts))
|
68 |
+
lineups_df['Lineup'] = lineups_df['Lineup'].replace(pid_map)
|
69 |
lineups_df = lineups_df[['Rank', 'EntryId', 'EntryName', 'TimeRemaining', 'Points', 'Lineup']]
|
70 |
|
71 |
total_data = lineups_df.merge(players_df, how='left', left_index=True, right_index=True)
|