James McCool commited on
Commit
0bb17b9
·
1 Parent(s): 401a7dd

Refactor WNBA lineup column order in load_contest_file.py

Browse files

- Adjusted the order of columns in the DataFrame for WNBA lineups to improve consistency and readability after parsing.
- Ensured that the 'Remove' column is still included while maintaining the integrity of player position assignments.

Files changed (1) hide show
  1. global_func/load_contest_file.py +2 -2
global_func/load_contest_file.py CHANGED
@@ -124,7 +124,7 @@ def load_contest_file(upload, type, helper = None, sport = None):
124
  elif sport == 'GOLF':
125
  cleaned_df[['Remove', 'Guy', 'Dude', 'Pooba', 'Bub', 'Chief', 'Buddy']] = cleaned_df['Lineup'].str.split(',', expand=True)
126
  elif sport == 'WNBA':
127
- cleaned_df[['Remove', 'Guard1', 'Guard2', 'Forward1', 'Forward2', 'Forward3', 'UTIL']] = cleaned_df['Lineup'].str.split(',', expand=True)
128
  cleaned_df = cleaned_df.drop(columns=['Lineup', 'Remove'])
129
  entry_counts = cleaned_df['BaseName'].value_counts()
130
  cleaned_df['EntryCount'] = cleaned_df['BaseName'].map(entry_counts)
@@ -135,7 +135,7 @@ def load_contest_file(upload, type, helper = None, sport = None):
135
  elif sport == 'GOLF':
136
  cleaned_df = cleaned_df[['BaseName', 'EntryCount', 'Guy', 'Dude', 'Pooba', 'Bub', 'Chief', 'Buddy']]
137
  elif sport == 'WNBA':
138
- cleaned_df = cleaned_df[['BaseName', 'EntryCount', 'Guard1', 'Guard2', 'Forward1', 'Forward2', 'Forward3', 'UTIL']]
139
  elif type == 'Showdown':
140
  if sport == 'NHL':
141
  cleaned_df['Lineup'] = cleaned_df['Lineup'].replace([' FLEX ', 'CPT '], value=',', regex=True)
 
124
  elif sport == 'GOLF':
125
  cleaned_df[['Remove', 'Guy', 'Dude', 'Pooba', 'Bub', 'Chief', 'Buddy']] = cleaned_df['Lineup'].str.split(',', expand=True)
126
  elif sport == 'WNBA':
127
+ cleaned_df[['Remove', 'Forward1', 'Forward2', 'Forward3', 'Guard1', 'Guard2', 'UTIL']] = cleaned_df['Lineup'].str.split(',', expand=True)
128
  cleaned_df = cleaned_df.drop(columns=['Lineup', 'Remove'])
129
  entry_counts = cleaned_df['BaseName'].value_counts()
130
  cleaned_df['EntryCount'] = cleaned_df['BaseName'].map(entry_counts)
 
135
  elif sport == 'GOLF':
136
  cleaned_df = cleaned_df[['BaseName', 'EntryCount', 'Guy', 'Dude', 'Pooba', 'Bub', 'Chief', 'Buddy']]
137
  elif sport == 'WNBA':
138
+ cleaned_df = cleaned_df[['BaseName', 'EntryCount', 'Forward1', 'Forward2', 'Forward3', 'Guard1', 'Guard2', 'UTIL']]
139
  elif type == 'Showdown':
140
  if sport == 'NHL':
141
  cleaned_df['Lineup'] = cleaned_df['Lineup'].replace([' FLEX ', 'CPT '], value=',', regex=True)