James McCool
commited on
Commit
·
c2b7029
1
Parent(s):
472d4c4
Refactor lineup replacement logic in load_contest_file.py
Browse files- Updated the lineup processing for Showdown contests to handle NHL separately, ensuring correct replacement of lineup formats based on sport type. This change improves data cleaning accuracy and maintains robustness in lineup handling.
global_func/load_contest_file.py
CHANGED
@@ -131,10 +131,10 @@ def load_contest_file(upload, type, helper = None, sport = None):
|
|
131 |
elif sport == 'GOLF':
|
132 |
cleaned_df = cleaned_df[['BaseName', 'EntryCount', 'Guy', 'Dude', 'Pooba', 'Bub', 'Chief', 'Buddy']]
|
133 |
elif type == 'Showdown':
|
134 |
-
|
135 |
-
cleaned_df['Lineup'] = cleaned_df['Lineup'].replace([' UTIL ', 'CPT '], value=',', regex=True)
|
136 |
-
except:
|
137 |
cleaned_df['Lineup'] = cleaned_df['Lineup'].replace([' FLEX ', 'CPT '], value=',', regex=True)
|
|
|
|
|
138 |
print(type)
|
139 |
check_lineups = cleaned_df.copy()
|
140 |
cleaned_df[['Remove', 'CPT', 'UTIL1', 'UTIL2', 'UTIL3', 'UTIL4', 'UTIL5']] = cleaned_df['Lineup'].str.split(',', expand=True)
|
|
|
131 |
elif sport == 'GOLF':
|
132 |
cleaned_df = cleaned_df[['BaseName', 'EntryCount', 'Guy', 'Dude', 'Pooba', 'Bub', 'Chief', 'Buddy']]
|
133 |
elif type == 'Showdown':
|
134 |
+
if sport == 'NHL':
|
|
|
|
|
135 |
cleaned_df['Lineup'] = cleaned_df['Lineup'].replace([' FLEX ', 'CPT '], value=',', regex=True)
|
136 |
+
else:
|
137 |
+
cleaned_df['Lineup'] = cleaned_df['Lineup'].replace([' UTIL ', 'CPT '], value=',', regex=True)
|
138 |
print(type)
|
139 |
check_lineups = cleaned_df.copy()
|
140 |
cleaned_df[['Remove', 'CPT', 'UTIL1', 'UTIL2', 'UTIL3', 'UTIL4', 'UTIL5']] = cleaned_df['Lineup'].str.split(',', expand=True)
|