In [21]:
import pandas as pd
import matplotlib as mp
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
wr_games = pd.read_csv('wr_games.csv')
wr_games.columns.values
Out[21]:
array(['Name', 'Year', 'Career Year', 'GameCount', 'Career Games', 'Date',
'Team', 'Opp', 'Result', 'Rec Rec', 'Rec Yds', 'Rec Avg', 'Rec Lg',
'Rec TD', 'Rec FD', 'Rec Tar', 'Rec YAC', 'Rush Date', 'Rush Team',
'Rush Opp', 'Rush Result', 'Rush Int', 'Rush Yds', 'Rush Avg',
'Rush Lg', 'Rush TD', 'Rush Solo', 'Rush Ast', 'Rush Tot',
'Rush Sack', 'Rush YdsL'], dtype=object)
In [25]:
rush_yd = wr_games['Rush Yds'] / 10
rec_yd = wr_games['Rec Yds'] / 10
rush_td = wr_games['Rush TD'] * 6
rec_td = wr_games['Rec TD'] * 6
wr_games['Fantasy Points'] = rush_yd + rec_yd + rush_td + rec_td
wr_fantasy = wr_games[['Name','Career Year', 'Year', 'GameCount', 'Career Games', 'Date', 'Rec Rec', 'Rec Yds', 'Rec TD', 'Rush Yds', 'Rush TD', 'Fantasy Points']]
wr_fantasy.head(10)
Out[25]:
Name
Career Year
Year
GameCount
Career Games
Date
Rec Rec
Rec Yds
Rec TD
Rush Yds
Rush TD
Fantasy Points
0
green, aj
1
2011
1
1
9/11/11
1
41
1
0
0
10.1
1
green, aj
1
2011
2
2
9/18/11
10
124
1
0
0
18.4
2
green, aj
1
2011
3
3
9/25/11
4
29
0
0
0
2.9
3
green, aj
1
2011
4
4
10/2/11
4
118
0
0
0
11.8
4
green, aj
1
2011
5
5
10/9/11
5
90
1
0
0
15.0
5
green, aj
1
2011
6
6
10/16/11
5
51
1
0
0
11.1
6
green, aj
1
2011
7
7
10/30/11
4
63
1
0
0
12.3
7
green, aj
1
2011
8
8
11/6/11
7
83
0
1
0
8.4
8
green, aj
1
2011
9
9
11/13/11
1
36
1
0
0
9.6
9
green, aj
1
2011
10
10
11/27/11
3
110
0
0
0
11.0
In [27]:
wr_2016 = wr_games.loc[(wr_games.Year == 2016) & (wr_games.GameCount < 19)]
print(len(wr_2016))
wr_2016_sum = wr_2016.groupby(['Name', 'Year'], as_index=False).sum()[['Name', 'Rush Yds', 'Rush TD', 'Rec Yds', 'Rec TD', 'Fantasy Points']]
wr_2016_sum = wr_2016_sum.sort_values(['Fantasy Points'], ascending=False)
wr_2016_sum.head(50)
2207
Out[27]:
Name
Rush Yds
Rush TD
Rec Yds
Rec TD
Fantasy Points
21
brown, antonio
0
0
1516
14
235.6
152
smith, steve
0
0
1598
10
219.8
125
nelson, jordy
0
0
1270
14
211.0
54
evans, mike
0
0
1321
12
204.1
11
beckham, odell
0
0
1395
10
199.5
1
adams, davante
0
0
1198
13
197.8
95
jones, julio
0
0
1476
7
189.6
9
baldwin, doug
1
0
1312
9
185.3
79
hilton, ty
0
0
1448
6
180.8
163
thomas, michael
0
0
1137
9
167.7
37
cooks, brandin
0
0
1173
8
165.3
25
bryant, dez
1
0
928
10
152.9
41
crabtree, michael
0
0
1036
8
151.6
114
matthews, rishard
0
0
945
9
148.5
177
williams, tyrell
0
0
1059
7
147.9
102
landry, jarvis
0
0
1238
4
147.8
38
cooper, amari
0
0
1163
5
146.3
51
edelman, julian
0
0
1243
3
142.3
83
hopkins, deandre
0
0
1086
5
138.6
55
fitzgerald, larry
0
0
1023
6
138.3
162
thomas, demaryius
0
0
1083
5
138.3
13
benjamin, kelvin
0
0
941
7
136.1
155
stills, kenny
0
0
808
9
134.8
160
tate, golden
0
0
1102
4
134.2
144
sanders, emmanuel
0
0
1032
5
133.2
20
britt, kenny
0
0
1002
5
130.2
42
crowder, jamison
1
0
847
7
126.8
161
thielen, adam
0
0
967
5
126.7
165
wallace, mike
2
0
1017
4
125.9
96
jones, marvin
0
0
1011
4
125.1
133
pryor, terrelle
2
0
1007
4
124.9
89
jackson, desean
0
0
1005
4
124.5
148
shepard, sterling
1
0
746
8
122.7
101
lafell, brandon
1
0
862
6
122.3
61
garcon, pierre
0
0
1041
3
122.1
33
cobb, randall
0
0
788
7
120.8
67
green, aj
0
0
964
4
120.4
10
beasley, cole
0
0
878
5
117.8
154
snead, willie
1
0
895
4
113.6
117
meredith, cameron
1
0
888
4
112.9
52
enunwa, quincy
0
0
857
4
109.7
17
boldin, anquan
0
0
608
8
108.8
47
diggs, stefon
0
0
903
3
108.3
88
inman, dontrelle
0
0
810
4
105.0
127
parker, devante
0
0
799
4
103.9
104
lee, marqise
1
0
851
3
103.2
80
hogan, chris
2
0
775
4
101.7
60
gabriel, taylor
0
0
650
6
101.0
145
sanu, mohamed
1
0
697
5
99.8
62
ginn, ted
0
0
752
4
99.2
In [28]:
wr_2016_sum.to_csv('wr_sanity.csv')
print('Done!')
Done!
In [41]:
wr_2016 = wr_games.loc[(wr_games.Year == 2016) & (wr_games.GameCount < 18)]
smith = wr_2016.loc[wr_2016.Name == 'smith, steve']
smith = smith[['Date', 'Rush Yds', 'Rush TD', 'Rec Yds', 'Rec TD', 'Fantasy Points']]
print(len(smith))
smith.head(28)
28
Out[41]:
Date
Rush Yds
Rush TD
Rec Yds
Rec TD
Fantasy Points
19158
9/11/16
0
0
19
0
1.9
19159
9/18/16
0
0
64
0
6.4
19160
9/25/16
0
0
87
0
8.7
19161
10/2/16
0
0
111
1
17.1
19162
10/9/16
0
0
29
0
2.9
19163
11/6/16
0
0
47
0
4.7
19164
11/10/16
0
0
60
1
12.0
19165
11/20/16
0
0
99
1
15.9
19166
11/27/16
0
0
20
0
2.0
19167
12/4/16
0
0
53
0
5.3
19168
12/12/16
0
0
57
0
5.7
19169
12/18/16
0
0
40
1
10.0
19170
12/25/16
0
0
79
1
13.9
19171
1/1/17
0
0
34
0
3.4
19388
9/11/16
0
0
19
0
1.9
19389
9/18/16
0
0
64
0
6.4
19390
9/25/16
0
0
87
0
8.7
19391
10/2/16
0
0
111
1
17.1
19392
10/9/16
0
0
29
0
2.9
19393
11/6/16
0
0
47
0
4.7
19394
11/10/16
0
0
60
1
12.0
19395
11/20/16
0
0
99
1
15.9
19396
11/27/16
0
0
20
0
2.0
19397
12/4/16
0
0
53
0
5.3
19398
12/12/16
0
0
57
0
5.7
19399
12/18/16
0
0
40
1
10.0
19400
12/25/16
0
0
79
1
13.9
19401
1/1/17
0
0
34
0
3.4
Content source: JohnPHogan/FantasyFootball
Similar notebooks: