James McCool commited on
Commit
cf0e214
·
1 Parent(s): 449ebce

Update position filtering logic in create_position_export_dict function in app.py to handle specific 'SP' position filtering, improving accuracy in player data exports.

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -46,9 +46,14 @@ def create_position_export_dict(column_name, csv_file):
46
 
47
  # Filter CSV file by position
48
  if 'Position' in csv_file.columns:
49
- filtered_df = csv_file[
50
- csv_file['Position'].str.contains(position_filter, na=False, regex=False)
51
- ]
 
 
 
 
 
52
  else:
53
  # Fallback to all players if no position column found
54
  filtered_df = csv_file
 
46
 
47
  # Filter CSV file by position
48
  if 'Position' in csv_file.columns:
49
+ if position_filter == 'SP':
50
+ filtered_df = csv_file[
51
+ csv_file['Roster Position'] == 'P'
52
+ ]
53
+ else:
54
+ filtered_df = csv_file[
55
+ csv_file['Position'].str.contains(position_filter, na=False, regex=False)
56
+ ]
57
  else:
58
  # Fallback to all players if no position column found
59
  filtered_df = csv_file