James McCool
commited on
Commit
·
d5f1d98
1
Parent(s):
f51c772
Refactor position eligibility checks in exposure_spread.py to simplify logic for player positions, enhancing readability and maintainability. Update reassess_dupes function in reassess_edge.py to streamline salary difference calculations for improved performance.
Browse files
global_func/exposure_spread.py
CHANGED
|
@@ -34,8 +34,18 @@ def check_lol_position_eligibility(column_name, player_positions):
|
|
| 34 |
def check_mlb_position_eligibility(column_name, player_positions):
|
| 35 |
if any(pos in column_name for pos in ['P', 'SP', 'RP']):
|
| 36 |
return any(pos in ['P', 'SP', 'RP'] for pos in player_positions)
|
| 37 |
-
elif
|
| 38 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
return False
|
| 40 |
|
| 41 |
def check_nfl_position_eligibility(column_name, player_positions):
|
|
|
|
| 34 |
def check_mlb_position_eligibility(column_name, player_positions):
|
| 35 |
if any(pos in column_name for pos in ['P', 'SP', 'RP']):
|
| 36 |
return any(pos in ['P', 'SP', 'RP'] for pos in player_positions)
|
| 37 |
+
elif 'C' in column_name:
|
| 38 |
+
return 'C' in player_positions
|
| 39 |
+
elif '1B' in column_name:
|
| 40 |
+
return '1B' in player_positions
|
| 41 |
+
elif '2B' in column_name:
|
| 42 |
+
return '2B' in player_positions
|
| 43 |
+
elif '3B' in column_name:
|
| 44 |
+
return '3B' in player_positions
|
| 45 |
+
elif 'SS' in column_name:
|
| 46 |
+
return 'SS' in player_positions
|
| 47 |
+
elif 'OF' in column_name:
|
| 48 |
+
return 'OF' in player_positions
|
| 49 |
return False
|
| 50 |
|
| 51 |
def check_nfl_position_eligibility(column_name, player_positions):
|
global_func/reassess_edge.py
CHANGED
|
@@ -10,12 +10,7 @@ import numpy as np
|
|
| 10 |
import math
|
| 11 |
|
| 12 |
def reassess_dupes(row: pd.Series, salary_max: int) -> float:
|
| 13 |
-
|
| 14 |
-
return math.ceil(row['Dupes'] + ((row['salary_diff'] / 100) * (row['own_diff'] / 100))).clip(lower=0)
|
| 15 |
-
elif row['salary'] != salary_max:
|
| 16 |
-
return math.ceil(row['Dupes'] + ((row['salary_diff'] / 100) * (row['own_diff'] / 100))).clip(lower=0)
|
| 17 |
-
else:
|
| 18 |
-
return row['Dupes']
|
| 19 |
|
| 20 |
def reassess_edge(refactored_frame: pd.DataFrame, original_frame: pd.DataFrame, maps_dict: dict, site_var: str, type_var: str, Contest_Size: int, strength_var: str, sport_var: str, salary_max: int) -> pd.DataFrame:
|
| 21 |
orig_df = original_frame.copy()
|
|
|
|
| 10 |
import math
|
| 11 |
|
| 12 |
def reassess_dupes(row: pd.Series, salary_max: int) -> float:
|
| 13 |
+
return math.ceil(row['Dupes'] + ((row['salary_diff'] / 100) + ((salary_max + (salary_max - row['salary'])) / 100)) * (1 - (row['own_diff'] / 100))).clip(lower=0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
def reassess_edge(refactored_frame: pd.DataFrame, original_frame: pd.DataFrame, maps_dict: dict, site_var: str, type_var: str, Contest_Size: int, strength_var: str, sport_var: str, salary_max: int) -> pd.DataFrame:
|
| 16 |
orig_df = original_frame.copy()
|