BurntSushi / nfldb

A library to manage and update NFL data in a relational database.
The Unlicense
1.08k stars 264 forks source link

See player position at time of game #242

Open ryantuck opened 7 years ago

ryantuck commented 7 years ago

I noticed that retired players have both position and team labeled UNK:

nfldb=# select * from player where full_name = 'Donovan McNabb';
-[ RECORD 1 ]--+--------------------------------------------------------
player_id      | 00-0011022
gsis_name      | D.McNabb
full_name      | Donovan McNabb
first_name     | Donovan
last_name      | McNabb
team           | UNK
position       | UNK
profile_id     | 2502044
profile_url    | http://www.nfl.com/player/donovanmcnabb/2502044/profile
uniform_number |
birthdate      | 11/25/1976
college        | Syracuse
height         | 74
weight         | 240
years_pro      | 13
status         | Unknown

This is problematic when attempting to run historical performance analysis for all QBs and Donovan McNabb is nowhere to be found (after filtering my query on position = 'QB').

No immediate solution to this problem presents itself after perusing the data model. I imagine I could remove the requirement that a player is a QB and simply analyze anyone who had meaningful passing yards in a given game, and back into whatever team they were on at the time a la the solution provided in #176. This would be a good-enough workaround for my purposes.

Am I missing something here, or is there no way to get a historical position?

CPOConnor commented 7 years ago

I had the same issue. I concluded there's really no consistent way to determine the position based on stats either (how would you tell a WR from a TE? Receiving stats + height/weight ratio? Still unreliable)

I ended up running a script that parsed retired player positions out of Pro Football Reference's csv files (http://static.pfref.com/years/2010/fantasy.htm) and updated that player's position in Postgres. I joined the PG data with the csv's on unknown player's full names and PG birthdates equaling Pro Football Reference ages. Kinda an invasive solution, and not 100% accurate (I'm sure I updated some retired WR named Chris Johnson to have the RB position or something like that).

Overall it made my life a lot easier, but note there are costs if you decide to go this route. Let me know if you'd like to use my code.

andymiller-og commented 7 years ago

@ryantuck feeling your pain. @CPOConnor would love if you would share your code... Would be much MUCH appreciated. anm5030@gmail.com