James McCool commited on
Commit
fd9eb32
·
1 Parent(s): a87b532

Update position indicator removal logic in `load_file.py` for improved data accuracy

Browse files

- Changed the regex logic to remove position indicators from the end of player entries instead of the beginning, ensuring cleaner data extraction and preventing misinterpretation of player names.

Files changed (1) hide show
  1. global_func/load_file.py +2 -2
global_func/load_file.py CHANGED
@@ -29,8 +29,8 @@ def load_file(upload):
29
  # Split into individual columns and remove position indicators
30
  for i in range(0,10):
31
  df[i] = df['Lineup'].str.split(',').str[i].str.strip()
32
- # Remove position indicators from the beginning of each entry
33
- df[i] = df[i].str.replace(r'^(' + '|'.join(pos_values) + r')\s+', '', regex=True)
34
  position_dict = dict(zip(df['Player'], df['Pos']))
35
  ownership_dict = dict(zip(df['Player'], df['Own']))
36
  entry_list = list(set(df['EntryName']))
 
29
  # Split into individual columns and remove position indicators
30
  for i in range(0,10):
31
  df[i] = df['Lineup'].str.split(',').str[i].str.strip()
32
+ # Remove position indicators from the end of each entry
33
+ df[i] = df[i].str.replace(r'\s+(' + '|'.join(pos_values) + r')$', '', regex=True)
34
  position_dict = dict(zip(df['Player'], df['Pos']))
35
  ownership_dict = dict(zip(df['Player'], df['Own']))
36
  entry_list = list(set(df['EntryName']))