-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
40 lines (31 loc) · 1.27 KB
/
main.py
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
import pandas as pd
# 2019 - 2022 Draft_Year
list_pngav = []
df_fy = 2023 # final year available in the data frame
df_ry = 2019 # if a player was drafted to the NFL after this date, they are considered a rookie that needs interpolated data
df_adp_av = pd.read_csv('./UPDATEDfinal_adp_av.csv')
df_summed_data = pd.read_csv('./iwannadieUPDATEDfinal_av.csv')
def find_rookie():
for c_index, row in df_summed_data.iterrows():
p_dy = row['Draft_Year']
if int(p_dy) > df_ry:
p_name = (row['Player'])
try:
p_pick = (row['Pick_Number'])
except:
p_pick = 0
p_cav = (row['Weighted Griddy AV']) # current AV in summed_data
df_dy_c = "drafted_" + str(int(p_dy)) # dataframe draft year column
p_interpolated = df_adp_av.loc[int(p_pick) - 1, df_dy_c] # player's interpolated av
p_ngav = p_cav + p_interpolated
else:
p_name = (row['Player'])
p_ngav = (row['Weighted Griddy AV'])
list_pngav.append([p_name, p_ngav])
save()
def save():
df = pd.DataFrame(list_pngav, columns=['Name', 'Griddy AV'])
filename = 'output.csv'
df.to_csv(filename, index=False)
print(f'Data written to {filename}')
find_rookie()