Live data from Hacker News

Fun with NFL Stats, Bokeh, and Pandas

j253.github.io

1–10 of 28 posts

Re: Fun with NFL Stats, Bokeh, and Pandas

#2
I feel like this is a waste of bokeh's potential and matplotlib would have sufficed. I love bokeh for the interactive capability and controlling what you plot, zooming, and just overall more immersive feeling than a static 2d plot.

Still very interesting and insightful and lovely plots generated.

Re: Fun with NFL Stats, Bokeh, and Pandas

#4
As someone who's done a lot of numerical analysis and watches a lot of football, the analysis here is pretty rudimentary.

> On third down, pass attempts outnumber run attempts at almost a 4 to 1 clip. This is likely out of increased desperation to make a first down.

Running is a low variance low yardage option, passing is a high variance high yardage option. Passing on third and medium to long is an obvious dominant strategy. Pulling the goaltender in hockey or bringing the keeper forward in soccer when trailing late in games/matches serves much the same effect.

Re: Fun with NFL Stats, Bokeh, and Pandas

#7
For a while I had a process to extract the top ten highest-WPA plays from my favorite team's (Broncos) most recent game. But then my data source dried up. I'm glad to find out about nflscrapR, it seems like that I might be able to figure out how to do that report again with recent play-by-play data.

Incidentally, that report was really fun during the 2011 Broncos season. Normally when you are finding the plays with the largest WPA swings, you'd expect them to be distributed among both teams. But since Tim Tebow became starting quarterback, I searched for the top ten largest WPA swings for the rest of the season - and from what I recall, every single one of those dramatic plays was in the Broncos favor. Weird. :-)

Re: Fun with NFL Stats, Bokeh, and Pandas

#8

I feel like this is a waste of bokeh's potential and matplotlib would have sufficed. I love bokeh for the interactive capability and controlling what you plot, zooming, and just overall more immersive feeling than a static 2d plot. Still very interesting and insightful and lovely plots generated.

Thanks. And I agree with Bokeh being overkill for this. My original intention was to make it fully interactive but I hit some snags on keeping the interactivity through Pelican SSG so I just kept 'em static.

Re: Fun with NFL Stats, Bokeh, and Pandas

#9
post #6

I've always enjoyed this project for pulling nfl stats. https://github.com/BurntSushi/nflgame

That project is no longer maintained because I don't use it any more, but others have picked up the baton: https://github.com/derek-adair/nflgame

Back in the day, I used nflgame along with

    https://github.com/BurntSushi/nfldb
    https://github.com/BurntSushi/nflvid
    https://github.com/BurntSushi/nflfan
to setup a simple local web UI that allowed me to quickly search through every play and watch any single play I wanted. Video footage was available as soon as the game was over, and play info was available live as the game was playing. It was amazing.

This worked because nflvid downloaded full HD NFL games from their CDN, which was unprotected at the time. (I paid for an NFL Game Pass subscription and never distributed the video footage.) They also had XML files that delineated the time at which each play started and its duration. Some ffmpeg slicing and dicing was all it took to cut up a full game and associate each clip with each play. That's all part of what nflvid does.

I hacked all of this together in my free time years ago, and I bet a lot of people would find it amazing. One wonders why the NFL doesn't build this and sell it themselves. When I used Game Pass a few years ago, you could search for plays with rudimentary criteria, but only over a single game at a time. It was artificially very limited.

Re: Fun with NFL Stats, Bokeh, and Pandas

#10
> The small spikes at 5 yard increments is interesting and I don't really have a good explanation other than to think that whoever recorded the yardage data liked rounding to the nearest 5 if it was close. Anyone else have any other ideas?

I'll go with the idea that the refs are biased with their ball placement and tend to put the ball on lines [0]. Also, players/teams practice, speak, think in 5 yard increments, so that's got to bias things a bit. "We've got to get to the 35 yard line for Morten to have a chance."

[0] https://gutterstats.wordpress.com/2015/11/03/are-nfl-officia...

Post reply on HN