James McCool commited on
Commit
b9bf803
·
1 Parent(s): ffa4d02

Adjust player column extraction logic in `load_file.py` to improve data handling

Browse files

- Modified the loop for creating player columns from the `Lineup` column to start from index 1 and end at `max_players - 1`, ensuring accurate extraction of player entries and preventing index errors.

Files changed (1) hide show
  1. global_func/load_file.py +1 -1
global_func/load_file.py CHANGED
@@ -41,7 +41,7 @@ def load_file(upload):
41
  return None
42
 
43
  # Create columns for each player
44
- for i in range(max_players):
45
  df[i] = df['Lineup'].str.split(',').str[i].str.strip()
46
  # Remove position indicators from the end of each entry
47
  df[i] = df[i].str.replace(r'\s+(' + '|'.join(pos_values) + r')$', '', regex=True)
 
41
  return None
42
 
43
  # Create columns for each player
44
+ for i in range(1, max_players - 1):
45
  df[i] = df['Lineup'].str.split(',').str[i].str.strip()
46
  # Remove position indicators from the end of each entry
47
  df[i] = df[i].str.replace(r'\s+(' + '|'.join(pos_values) + r')$', '', regex=True)