Comments (7)
Yuck.
As of now, nfldb gets team and position data for players based on the current team roster. Take a look at the SEA and ATL rosters: http://www.nfl.com/teams/seattleseahawks/roster?team=SEA and http://www.nfl.com/teams/seattleseahawks/roster?team=ATL
See anything missing?
So that's why. The question is now, what to do about it.
I'll look into pulling team/position data from their profile page and the team's roster page.
from nfldb.
Ah, it would work perfectly during the season. But during the offseason, when a roster churns, it could be out of whack. Thanks for looking at it, Andrew!
from nfldb.
I think that an issue that I am facing is related to this as well...
I am trying to aggregate a team's forced fumbles for 2013. In this example, Arizona:
import nfldb
db = nfldb.connect()
q = nfldb.Query(db)
q.game(season_year=2013, season_type='Regular', team='ARI')
# Get all Forced Fumbles
q.play(pos_team__ne='ARI', down__ne=0)
plays = q.as_plays()
run_total = 0
aggregated = nfldb.aggregate(plays)
aggregated = sorted(aggregated, key=lambda p: p.defense_ffum, reverse=True)
for pp in aggregated:
if pp.team == "ARI":
print pp.player, pp.defense_ffum
run_total += pp.defense_ffum
print run_total
output:
John Abraham (ARI, OLB) 4
Jerraud Powers (ARI, CB) 1
Tyrann Mathieu (ARI, FS) 1
Darnell Dockett (ARI, DE) 1
Calais Campbell (ARI, DE) 1
Sam Acho (ARI, OLB) 1
Matt Shaughnessy (ARI, OLB) 1
Marcus Benard (ARI, LB) 1
Jasper Brinkley (MIN, ILB) 0
Rashad Johnson (ARI, FS) 0
Lorenzo Alexander (ARI, OLB) 0
Karlos Dansby (CLE, ILB) 0
Yeremiah Bell (UNK, UNK) 0
Dan Williams (ARI, NT) 0
Patrick Peterson (ARI, CB) 0
Antoine Cason (CAR, CB) 0
Frostee Rucker (ARI, DE) 0
Tony Jefferson (ARI, FS) 0
Justin Bethel (ARI, CB) 0
Ronald Talley (ARI, DE) 0
Javier Arenas (ATL, CB) 0
Alameda Ta'amu (ARI, NT) 0
Kenny Demens (ARI, ILB) 0
Dontay Moch (CIN, LB) 0
Daryl Washington (ARI, ILB) 0
Jaron Brown (ARI, WR) 0
Bryan McCann (ARI, DB) 0
11
You will notice that many of these players played for ARI in 2013, but they are listed on another team now. No problem with that. The issue here is that Karlos Dansby had a Forced Fumble last year that is not listed.
It seems way more likely that there is something wrong with my code, but I ran across this today and recalled this issue.
Do you think this is related?
from nfldb.
@gojonesy No, it's probably not related. Player affiliations don't really have anything to do with the connection between players and statistics. A single missing forced fumble among otherwise correct data probably just indicates that the source data was wrong. (Although to verify, you should try and locate the specific play where it occurred and see if it's logged in nfldb or possibly nflgame.)
I did try out your code and I think it's right. But I simplified it for you:
import nfldb
db = nfldb.connect()
q = nfldb.Query(db)
q.game(season_year=2013, season_type='Regular', team='ARI')
q.play(team='ARI', pos_team__ne='ARI', down__ne=0)
run_total = 0
for pp in q.sort('defense_ffum').as_aggregate():
print pp.player, pp.defense_ffum
run_total += pp.defense_ffum
print run_total
The key is taking advantage of the team
field on the play_player
table. You were half way there with pos_team__ne='ARI'
(which is an attribute of a play).
Also, aggregating and sorting inside the database is much faster. :-)
from nfldb.
Thanks for that Andrew. That seems way more efficient.
Dansby still doesn't show a Forced Fumble. NFL.com shows that he had one on 10/13 against San Francisco.
I may have just stumbled across a random data inconsistency...
Thanks for your help
from nfldb.
I may have just stumbled across a random data inconsistency...
This isn't improbable. There are a lot of data inaccuracies, unfortunately. I did a test measuring inaccuracies last season: https://github.com/BurntSushi/nflgame/tree/master/test-data/results-yahoo-2012-max
You can see, for example, the results of defensive end stats: https://github.com/BurntSushi/nflgame/blob/master/test-data/results-yahoo-2012-max/de.tsv --- There are several players with slightly off forced fumble statistics, tackles, etc.
(Note that the players that are waaaay off are likely a result of an invalid player match in my test rather than actual inaccuracies.)
FYI, there's really nothing we can do. These are straight from the JSON data.
from nfldb.
Closing this for now. I think the kinks may have worked themselves out.
Note though that there are still a bunch of players who don't have gsis identifiers yet. This will produce some vomit if you run nfldb-update
and it tries updating the player meta data. This is OK and it should hopefully start to disappear as we get closer to the season.
from nfldb.
Related Issues (20)
- Any active users here? HOT 36
- nfldb-update: command not found HOT 4
- New Season HOT 2
- pip freeze
- Has the NFL ever complained about this project? HOT 2
- pip error
- Game gsis_id = 2017111911 missing in schedule.json (Ochawkeye issue #298)
- Not able to install in Windows HOT 2
- pip installation error HOT 1
- ConfigParser with-update HOT 1
- GSIS ID 2019090808 (CIN @ SEA) stored incomplete JSON to database, unable to replace HOT 4
- Bulk Upload 2017-2019 nfldb-update HOT 4
- Installed and ran nfldb-update. Data Missing for 2017 and 2018 HOT 2
- Expected Points & Win Probability HOT 1
- KeyError Gsis_id = 2019122202
- NFL Update HOT 1
- Anyone have a .sql export with 2019? HOT 1
- XML feeds removed from NFL website? HOT 4
- NFL db update on Anaconda help HOT 1
- Odoo v14 error HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nfldb.