Skip to content

Instantly share code, notes, and snippets.

@atestu
Created January 25, 2014 17:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atestu/8620132 to your computer and use it in GitHub Desktop.
Save atestu/8620132 to your computer and use it in GitHub Desktop.
Using nfldb to get the top players in the NFL in 2013
import nfldb
import json
from pprint import pprint
db = nfldb.connect()
q = nfldb.Query(db)
q.game(season_year=2013).player()
print json.dumps(map(lambda pp: {
'player': pp.player.full_name,
'team': pp.player.team,
'receiving_yds': pp.receiving_yds,
'fumbles_tot': pp.fumbles_tot,
'rushing_yds': pp.rushing_yds,
'tackles': pp.defense_tkl_primary
}, q.sort('receiving_yds').as_aggregate()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment