James McCool
commited on
Commit
·
9fddcf9
1
Parent(s):
39b94b7
ping
Browse files
app.py
CHANGED
|
@@ -1043,21 +1043,17 @@ def parse_portfolio_on_mapped(portfolio, map_dict, map_key, filter_keys_pos, fil
|
|
| 1043 |
high_mask = mapping_port < high_threshold
|
| 1044 |
mask = low_mask & high_mask
|
| 1045 |
else:
|
| 1046 |
-
# String mapping - filter by inclusion in filter_keys
|
| 1047 |
pos_mask = False
|
| 1048 |
team_mask = False
|
| 1049 |
|
| 1050 |
-
# Handle position filtering (for multi-position players like PG/SG)
|
| 1051 |
if filter_keys_pos:
|
| 1052 |
# Create a regex pattern that matches any of the selected positions
|
| 1053 |
pos_pattern = '|'.join([f'\\b{pos}\\b' for pos in filter_keys_pos])
|
| 1054 |
pos_mask = mapping_port.str.contains(pos_pattern, case=False, na=False, regex=True)
|
| 1055 |
|
| 1056 |
-
# Handle team filtering
|
| 1057 |
if filter_keys_team:
|
| 1058 |
team_mask = mapping_port.isin(filter_keys_team)
|
| 1059 |
|
| 1060 |
-
# Combine masks with OR logic
|
| 1061 |
mask = pos_mask | team_mask
|
| 1062 |
|
| 1063 |
return portfolio[mask]
|
|
|
|
| 1043 |
high_mask = mapping_port < high_threshold
|
| 1044 |
mask = low_mask & high_mask
|
| 1045 |
else:
|
|
|
|
| 1046 |
pos_mask = False
|
| 1047 |
team_mask = False
|
| 1048 |
|
|
|
|
| 1049 |
if filter_keys_pos:
|
| 1050 |
# Create a regex pattern that matches any of the selected positions
|
| 1051 |
pos_pattern = '|'.join([f'\\b{pos}\\b' for pos in filter_keys_pos])
|
| 1052 |
pos_mask = mapping_port.str.contains(pos_pattern, case=False, na=False, regex=True)
|
| 1053 |
|
|
|
|
| 1054 |
if filter_keys_team:
|
| 1055 |
team_mask = mapping_port.isin(filter_keys_team)
|
| 1056 |
|
|
|
|
| 1057 |
mask = pos_mask | team_mask
|
| 1058 |
|
| 1059 |
return portfolio[mask]
|