Spaces:
Build error
Build error
James McCool commited on
Commit ·
537d24c
1
Parent(s): 50daa3e
Fixing C/1B exportfile issue
Browse files
app.py
CHANGED
|
@@ -1156,9 +1156,14 @@ def create_position_export_dict(column_name, csv_file, site_var, type_var, sport
|
|
| 1156 |
elif position_filter == 'SFLEX':
|
| 1157 |
filtered_df = csv_file.copy()
|
| 1158 |
elif position_filter == 'C/1B':
|
| 1159 |
-
|
| 1160 |
-
|
| 1161 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1162 |
else:
|
| 1163 |
filtered_df = csv_file[
|
| 1164 |
csv_file['Position'].str.contains(position_filter, na=False, regex=False)
|
|
|
|
| 1156 |
elif position_filter == 'SFLEX':
|
| 1157 |
filtered_df = csv_file.copy()
|
| 1158 |
elif position_filter == 'C/1B':
|
| 1159 |
+
# FanDuel MLB: column is C/1B; pool rows use Position C / 1B and often Roster Position "C/1B".
|
| 1160 |
+
# pandas str.contains(pat) requires a string — passing a list broke this branch and yielded empty ID maps.
|
| 1161 |
+
pos_series = csv_file['Position'].astype(str).str.strip()
|
| 1162 |
+
c1b_mask = pos_series.isin(['C', '1B', 'C/1B'])
|
| 1163 |
+
if 'Roster Position' in csv_file.columns:
|
| 1164 |
+
rp = csv_file['Roster Position'].astype(str).str.strip()
|
| 1165 |
+
c1b_mask = c1b_mask | rp.isin(['C/1B', 'C', '1B'])
|
| 1166 |
+
filtered_df = csv_file[c1b_mask]
|
| 1167 |
else:
|
| 1168 |
filtered_df = csv_file[
|
| 1169 |
csv_file['Position'].str.contains(position_filter, na=False, regex=False)
|