-
Notifications
You must be signed in to change notification settings - Fork 3
/
mvp_statline.py
70 lines (52 loc) · 1.43 KB
/
mvp_statline.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#predicting the MVP statline
import numpy as np
import csv
np.random.seed(1)
#past mvp winners, team records, etc?
mvps = []
mvps_teams = []
players = []
mvp_bp = []
#MVPs
mvpReader = csv.reader(open('data/mvps.csv', newline=''), delimiter=',', quotechar='|')
for row in mvpReader:
article = []
article.append(''.join(row[0]))
article.append(''.join(row[1]))
mvps.append(article)
#MVP BLUEPRINT GENERATION
CSV_START_COLUMN = 7
CSV_END_COLUMN = 53
mvp_stats = np.genfromtxt('data/mvps.csv', delimiter=',', skip_header=1,
usecols=np.arange(CSV_START_COLUMN,CSV_END_COLUMN), invalid_raise=False)
#mvp era weightage (/1)
dfp_weight = 0.15
lbj_weight = 0.25
tpr_weight = 0.60
def blueprint():
mvp_amt = len(mvp_stats)
# "The Days of Future Past"
bloop_one = mvp_stats[0]
for i in range(7):
bloop_one = np.add(bloop_one, mvp_stats[i+1])
bloop_one = dfp_weight*(np.divide(bloop_one, 8))
# "The Lebron James Era"
j = 8
bloop_two = mvp_stats[8]
while j < 12:
bloop_two = np.add(bloop_two, mvp_stats[j+1])
j += 1
bloop_two = lbj_weight*(np.divide(bloop_two, 5))
# "The Three Point Revolution"
k = 13
bloop_three = mvp_stats[13]
while k < 17:
bloop_three = np.add(bloop_three, mvp_stats[k+1])
k += 1
bloop_three = tpr_weight*(np.divide(bloop_three, 5))
mvp_bloop = np.add(bloop_one, bloop_two)
mvp_bloop = np.add(mvp_bloop, bloop_three)
return mvp_bloop
if __name__ == "__main__":
mvp_bp = blueprint()
print(mvp_bp)