Skip to content

Instantly share code, notes, and snippets.

@ochawkeye
Last active October 27, 2015 13:51
Show Gist options
  • Save ochawkeye/74c267e531dede6d9f90 to your computer and use it in GitHub Desktop.
Save ochawkeye/74c267e531dede6d9f90 to your computer and use it in GitHub Desktop.
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)
@ochawkeye
Copy link
Author

Fourth down attempts, week 7 2015
Total attempts: 19
Successful attempts:  6 (31.58%)
Failed attempts:  13 (68.42%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment