Last active
October 27, 2015 13:51
-
-
Save ochawkeye/74c267e531dede6d9f90 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import nflgame | |
year, week = 2015, 7 | |
games = nflgame.games(year=year, week=week) | |
plays = nflgame.combine_plays(games).filter(fourth_down_att=True) | |
attempts = 0 | |
att_converted = 0 | |
att_failed = 0 | |
for play in plays: | |
attempts += play.fourth_down_att | |
att_converted += play.fourth_down_conv | |
att_failed += play.fourth_down_failed | |
print 'Fourth down attempts, week {} {}'.format(week, year) | |
print 'Total attempts: {}'.format(attempts) | |
print 'Successful attempts: {:2} ({:.2f}%)'.format(att_converted, float(att_converted)/attempts*100) | |
print 'Failed attempts: {:2} ({:.2f}%)'.format(att_failed, float(att_failed)/attempts*100) |
Author
ochawkeye
commented
Oct 27, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment