-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNonQualifiersStatBased.py
More file actions
59 lines (49 loc) · 2.65 KB
/
NonQualifiersStatBased.py
File metadata and controls
59 lines (49 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Imports
import pandas as pd
import random
# Your File Path
file_path = 'Files/Madden26/IE/Season1/Final_PreAdjustment.csv'
df = pd.read_csv(file_path)
def add_regression_points(row):
position = row['Position']
years_pro = row['YearsPro']
contract_status = row['ContractStatus']
rating_tier = row['RatingTier']
skill_point_off = row['SkillPointOff']
skill_point_ol = row['SkillPointOL']
skill_point_def = row['SkillPointDef']
regression_points = row['RegressionPoints']
if position in ['WR', 'TE'] and contract_status in ['Signed', 'PracticeSquad']:
if rating_tier in ['tier_0', 'tier_1', 'tier_2', 'tier_3'] and years_pro != 0 and pd.isna(skill_point_off):
regression_points += 3
elif rating_tier in ['tier_4', 'tier_5', 'tier_6'] and years_pro != 0 and pd.isna(skill_point_off):
regression_points += 2
elif years_pro == 0 and pd.isna(skill_point_off):
regression_points += 1
if position == 'HB' and contract_status in ['Signed', 'PracticeSquad']:
if rating_tier in ['tier_0', 'tier_1', 'tier_2', 'tier_3'] and years_pro != 0 and pd.isna(skill_point_off):
regression_points += 3
elif rating_tier in ['tier_4', 'tier_5', 'tier_6'] and years_pro != 0 and pd.isna(skill_point_off):
regression_points += 1
elif years_pro == 0 and pd.isna(skill_point_off):
regression_points += 1
if position in ['LT', 'LG', 'C', 'RG', 'RT'] and contract_status in ['Signed', 'PracticeSquad']:
if rating_tier in ['tier_0', 'tier_1', 'tier_2', 'tier_3'] and years_pro != 0 and pd.isna(skill_point_ol):
regression_points += 3
elif rating_tier in ['tier_4', 'tier_5', 'tier_6'] and years_pro != 0 and pd.isna(skill_point_ol):
regression_points += 2
elif years_pro == 0 and pd.isna(skill_point_ol):
regression_points += 1
if position in ['LE', 'DT', 'RE', 'LOLB', 'MLB', 'ROLB', 'CB', 'FS', 'SS'] and contract_status in ['Signed', 'PracticeSquad']:
if rating_tier in ['tier_0', 'tier_1', 'tier_2', 'tier_3'] and years_pro != 0 and pd.isna(skill_point_def):
regression_points += 3
elif rating_tier in ['tier_4', 'tier_5', 'tier_6'] and years_pro != 0 and pd.isna(skill_point_def):
regression_points += 2
elif years_pro == 0 and pd.isna(skill_point_def):
regression_points += 1
row['RegressionPoints'] = regression_points
return row
# Apply the new function to update the DataFrame
df = df.apply(add_regression_points, axis=1)
output_filename = 'Final.csv'
df.to_csv('Files/Madden26/IE/Season1/Final_AllStatBased.csv', index=False)