NFL Injury Data with BS4 & Plotly in Python

Max Bade
2 min readNov 16, 2022

A Very Hacky Scrapey way to get NFL Injury Data

I mean at the bare minimum you can steal pieces of the code for something else, right?

The results are pretty self-explanatory — NFL Injury data of the first 10 Seasons over the past 11 years. Don’t ask me why I didn’t just do 10 and 10. You get what you get.

Explain the code?

Eh. It’s a small function that grabs all html tables on the nfl injury pages, strips them down to lists, splits elements into a single column in a data frame, filters out all rows but weekly statuses per player name (but without the player name), throws the year in which the injury happened in another column, then throws in a column for row number partitioned by year (need something for the x-axis), then creates a grouped df by year by injury status and lastly plots it. Whatever, it runs out of the gate, just run it and impress your friends.

Takeaways:

  • 2016 was a bad year for Questionables…
  • 2022 is second worst so far though
  • Kind of looks like it’s normalizing… if you look at it long enough

Thanks for reading.

Max

--

--

Max Bade

Data Science and Analytics Consultant. Email: Maxbade@yahoo.com. linkedIn:www.linkedin.com/in/maxbade github:https://github.com/maxwellbade