James McCool
commited on
Commit
·
c0ae0e3
1
Parent(s):
fba063e
Implement error handling in exposure_spread function to ensure robust position extraction. If an error occurs during position parsing, fallback to the original position list, enhancing reliability in player eligibility processing.
Browse files
global_func/exposure_spread.py
CHANGED
@@ -225,9 +225,12 @@ def exposure_spread(working_frame, exposure_player, exposure_target, exposure_st
|
|
225 |
# players can be eligible at multiple positions, so we need to find all the positions the player is eligible at
|
226 |
# the position column can have positions designated as 1B/OF which means they are eligible at 1B and OF
|
227 |
comp_player_position = comparable_players['position'].tolist()
|
228 |
-
|
229 |
-
|
230 |
-
|
|
|
|
|
|
|
231 |
|
232 |
def has_position_overlap(player_positions, target_positions):
|
233 |
player_pos_list = player_positions.split('/')
|
|
|
225 |
# players can be eligible at multiple positions, so we need to find all the positions the player is eligible at
|
226 |
# the position column can have positions designated as 1B/OF which means they are eligible at 1B and OF
|
227 |
comp_player_position = comparable_players['position'].tolist()
|
228 |
+
try:
|
229 |
+
comp_player_position = [pos.split('/') for pos in comp_player_position]
|
230 |
+
comp_player_position = [item for sublist in comp_player_position for item in sublist]
|
231 |
+
comp_player_position = list(set(comp_player_position))
|
232 |
+
except:
|
233 |
+
comp_player_position = comparable_players['position'].tolist()
|
234 |
|
235 |
def has_position_overlap(player_positions, target_positions):
|
236 |
player_pos_list = player_positions.split('/')
|