James McCool
commited on
Commit
·
583a033
1
Parent(s):
efbfb51
Improve player eligibility check in exposure_spread function by adding salary constraint for replacement players, ensuring accurate exposure adjustments while maintaining clarity in player selection logic.
Browse files- global_func/exposure_spread.py +14 -10
global_func/exposure_spread.py
CHANGED
@@ -353,18 +353,22 @@ def exposure_spread(working_frame, exposure_player, exposure_target, exposure_st
|
|
353 |
row_data = working_frame.iloc[row]
|
354 |
for col in working_frame.columns:
|
355 |
if row_data[col] in comparable_player_list:
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
if
|
|
|
|
|
|
|
|
|
363 |
working_frame.at[row, col] = exposure_player
|
364 |
break
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
change_counter += 1
|
369 |
return working_frame
|
370 |
|
|
|
353 |
row_data = working_frame.iloc[row]
|
354 |
for col in working_frame.columns:
|
355 |
if row_data[col] in comparable_player_list:
|
356 |
+
if working_frame.iloc[row]['salary'] + projections_df[projections_df['player_names'] == row_data[col]]['salary'].iloc[0] <= salary_max:
|
357 |
+
print(row_data[col])
|
358 |
+
# Get the replacement player's positions
|
359 |
+
replacement_player_positions = projections_df[projections_df['player_names'] == row_data[col]]['position'].iloc[0].split('/')
|
360 |
+
|
361 |
+
# Check if the replacement player is eligible for this column
|
362 |
+
if type_var == 'Classic':
|
363 |
+
if check_position_eligibility(sport_var, col, replacement_player_positions):
|
364 |
+
working_frame.at[row, col] = exposure_player
|
365 |
+
break
|
366 |
+
else:
|
367 |
working_frame.at[row, col] = exposure_player
|
368 |
break
|
369 |
+
else:
|
370 |
+
change_counter -= 1
|
371 |
+
continue
|
372 |
change_counter += 1
|
373 |
return working_frame
|
374 |
|