Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

combine_max_stats by quarter #344

Open
mesee298 opened this issue Nov 10, 2017 · 1 comment
Open

combine_max_stats by quarter #344

mesee298 opened this issue Nov 10, 2017 · 1 comment

Comments

@mesee298
Copy link

Is there a way that you can get by quarter the combine_max_stats for a player?

@ochawkeye
Copy link
Contributor

Not really a native way to do this, but you can get pretty close.

For example, you can see who threw for the most yards in the 4th quarter of games like so:

import nflgame

def filter_quarter_plays(qtr, plays):
    qtr_start = nflgame.game.GameClock(qtr, '15:00')
    qtr_end = nflgame.game.GameClock(qtr, '0:00')
    return plays.filter(time__le=qtr_end).filter(time__ge=qtr_start)

games = nflgame.games(2017, kind='REG')
plays = nflgame.combine_plays(games)

fourth_quarter_plays = filter_quarter_plays(4, plays)

for player in fourth_quarter_plays.players().sort('passing_yds').limit(15):
    print player, player.passing_yds
R.Wilson 1303
D.Brees 1240
B.Roethlisberger 1212
D.Carr 1175
D.Prescott 1139
M.Stafford 1119
M.Ryan 1107
E.Manning 1097
J.Winston 1085
K.Cousins 1053
A.Smith 996
P.Rivers 912
T.Brady 906
D.Kizer 906
J.Cutler 821

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants