A library to manage and update NFL data in a Postgres database updated for Python 3.8. Based on code written byAndrew Gallant.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file nfldb3-0.0.1.tar.gz
.
File metadata
- Download URL: nfldb3-0.0.1.tar.gz
- Upload date:
- Size: 61.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c773e4ee634170065ad2f7676911ac3b695754db5e8b91847822ab570b3d502a |
|
MD5 | b7b9ba78d4025fdf879a6da19a995dfd |
|
BLAKE2b-256 | 8bdc885bc9b6feaf6f2998be1213df8f538cc77d93ee7c7604f338cf4c7f23ce |
File details
Details for the file nfldb3-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: nfldb3-0.0.1-py3-none-any.whl
- Upload date:
- Size: 66.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 296c1ba24341290908a9450b487bb0b798a091975d09176d652f5d9dcbb1c4d5 |
|
MD5 | 16f83b8bded919376724ed4e7ae8b34e |
|
BLAKE2b-256 | 7ba7560a1613a3fe812faa8107c064fd5d9af946c6febc2f60e28ddf2429cdc2 |