Skip to main content

Module nfldb provides command line tools and a library for maintaining and querying a relational database of play-by-play NFL data. The data is imported from nflgame, which in turn gets its data from a JSON feed on NFL.com’s live GameCenter pages. This data includes, but is not limited to, game schedules, scores, rosters and play-by-play data for every preseason, regular season and postseason game dating back to 2009.

Here is a small teaser that shows how to use nfldb to find the top five passers in the 2012 regular season:

#!python
import nfldb

db = nfldb.connect()
q = nfldb.Query(db)

q.game(season_year=2012, season_type='Regular')
for pp in q.sort('passing_yds').limit(5).as_aggregate():
    print pp.player, pp.passing_yds

And the output is:

[andrew@Liger ~] python2 top-five.py
Drew Brees (NO, QB) 5177
Matthew Stafford (DET, QB) 4965
Tony Romo (DAL, QB) 4903
Tom Brady (NE, QB) 4799
Matt Ryan (ATL, QB) 4719

In theory, both nfldb and nflgame provide access to the same data. The difference is in the execution. In order to search data in nflgame, a large JSON file needs to be read from disk and loaded into Python data structures for each game. Conversely, nfldb’s data is stored in a relational database, which can be searched and retrieved faster than nflgame by a few orders of magnitude. Moreover, the relational organization of data in nfldb allows for a convenient query interface to search NFL play data.

The database can be updated with real time data from active games by running the nfldb-update script included with this module as often as you’re comfortable pinging NFL.com. (N.B. The JSON data itself only updates every 15 seconds, so running nfldb-update faster than that would be wasteful.) Roster updates are done automatically at a minimum interval of 12 hours.

nfldb has comprehensive API documentation and a wiki with examples.

nfldb can be used in conjunction with nflvid to search and watch NFL game footage.

If you need help, please join us at our IRC channel #nflgame on FreeNode.

Release files for nfldb 0.2.17

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nfldb 0.2.17
File Size Uploaded
nfldb-0.2.17.tar.gz 1.3 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for nfldb 0.2.17
File Interpreter ABI Platform
nfldb-0.2.17.linux-x86_64.exe Details

Total release size: 2.7 MB

Release files / nfldb-0.2.17.tar.gz

Download URL nfldb-0.2.17.tar.gz
Size 1.3 MB
Tags Source
SHA-256 checksum
How to use checksums
8a9e190e9a38b156ad8f445c2379ec7eae4146850a1a410efa34a5dfd304555f
BLAKE2b-256 checksum
How to use checksums
76cce0194496fd7e598c83252ae16e2cd69df5b0363f3fd74b812b9551e83507
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / nfldb-0.2.17.linux-x86_64.exe

Download URL nfldb-0.2.17.linux-x86_64.exe
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
1c1ee73a699a7292053e74bc8386882c19652a1b146081ab9ae550e8a57db8d6
BLAKE2b-256 checksum
How to use checksums
a9ce7397d1a0746f02c531e38a38a0cee72023668d24cdcf72f928d8b24daa35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2.17 This release

2 release files

0.2.15

2 release files

0.2.14

1 release file

0.2.12

2 release files

0.2.10

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.14

2 release files

0.0.13

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page