Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time accurate player-on-team data #176

Open
kennysushi opened this issue Sep 2, 2016 · 1 comment
Open

Time accurate player-on-team data #176

kennysushi opened this issue Sep 2, 2016 · 1 comment

Comments

@kennysushi
Copy link

kennysushi commented Sep 2, 2016

Been digging through nfldb recently. Really easy to understand & powerful tool. Great work! One thing I noticed is that when querying past data (ie 2015 stats) that player data returns with their current (2016) team information. For example:

(43, 'Zach Mettenberger (PIT, QB)'),

Despite a 2015 game query, it thinks that ZM is on PIT, which didn't happen until 2016. I'd imagine this issue propagates further back as well when players change teams? Is there any way to link time-accurate team-player data?

edit:
I see this was also discussed here but solution was never reached #157

@ochawkeye
Copy link
Contributor

ochawkeye commented Sep 14, 2016

All depends on how you're querying the data.

You could do something like this:

import nfldb

db = nfldb.connect()
q = nfldb.Query(db)
q.game(season_year=2009, week=1, season_type='Regular', team='MIN')

for pp in q.as_play_players():
    print 'Player:', pp.player
    print '\tTeam at time of game:', pp.team  # Use this to get the player's team
    print '\tCurrent team:', pp.player.team  # Not this which would get the player's current team
Player: Abram Elam (UNK, UNK)
    Team at time of game: CLE
    Current team: UNK
.
.
.
Player: Chad Greenway (MIN, OLB)
    Team at time of game: MIN
    Current team: MIN
.
.
.
Player: Phil Dawson (SF, K)
    Team at time of game: CLE
    Current team: SF
.
.
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants