Data Web Scraping NBA Stats
The skills the author demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.
This is my second project. A project focused on web scraping and producing data models and insights to viewers that they would not typically see or be able to extract from certain data upon first observation. I am passionate about sports and thought connecting data science to sports in this project would be very intriguing.
The technology industry has taken over every realm of society it seems like with little opposition. From the way people entertain ourselves with our smart phones and social media all the way to how business operate and how they sell and market their products and respective brands. It seems hand in hand with this takeover, Data Science has seen a profound boom in its prominence in its use and application today due to the benefits and new realizations that people have come to see through the various new models and new statistics formed by machine learning programs as well as analytics.
For this reason alone, sports has seen a dramatic increase in the use of analytics and various algorithms and programs too see what factors not looked at before can increase a teams chance of winning as well as the organization's chance at future success. I personally, am a avid sports fan who takes every chance he can get to discuss and learn more about people's favorite teams as well as their philosophies and opinions on what they think is most important or crucial in creating a successful team in any sport.
In this project I focused on basketball and tried to find new little statistics that could be seen through their prevalence on successful teams as a factor crucial in order to win and be successful.Through scraping nba statistics from teamrankings.com from last season and engineering the data, I attempted to find new and improved ways that analytically can be shown to be crucial to winning championships and are apparent on top tier teams such as the Cavaliers and Warriors.
I did this by creating a scraper that scraped teamrankings.com for NBA statistics from last season. The categories I scraped were each teams Average 4th Quarter margin, Each teams average points from 3-pt FGs per game, each teams average Points in the Paint per Game, as well as each teams total points resulting from fast break opportunities. Upon scraping, the resulting csv files show for the 4 categories: each teams rank compared to the rest of the league, their average of that statistic for the season, the respective statistic from the previous game, average of that statistic over the last 3 games, as well as their averages both on the road as well as at home.
This is what the resulting csv file for total points in the paint per game:
I believe these statistics are some of the most important and crucial to success in basketball and hopefully some of my statistics, models and graphs can strengthen my assertion.
Home and Away Averages
Unfortunately for me in wanting some results with strong correlations, none can strongly be made in terms of winning the 4th quarter resulting in championships. 7 of the top 10 teams in this category did make the playoffs with the champion Warriors coming in at 6, but their opponent in last years finals, the Cavaliers were 27th out of 30 teams in the category but seemed to be doing just fine in coasting to their 3rd straight finals appearance.
For one that is familiar with basketball, know from the perspective that basketball is a game of 4 quarters, good teams may already have handled lesser competition in 3 quarters by more than 20 points for example and are not affected by their losing margin in the 4th because it does not pose any significance to the end outcome of the game. In terms of further research one could look to see games that go into the fourth quarter with a team trailing by 5 or less points as a more effective way of analyzing performance in the 4th because that involves the clutch factor.
Fast Break Points
When looking at FastBreak Points per game I thought it would be interesting to see teams change in averages from the 2015 season to the 2016 season.
17 teams improved from the season before while 13 did not. Of the 3 of the final 4 teams from the NBA 2016 Season (Cavs, Warriors, Spurs, Celtics) only the Celtics decreased in their average fast break points per game. Both six seeds (OKC and Bucks) and seven seeds(Pacers and Griz) from each conference decreased in their averages from the previous season along with one 5 seed (Hawks), 3 seed(Rockets), and 4 seed(Wizards).
None of these teams looking at statistics as well as the overall eye test had a chance at winning the championship last season and does show the increasing value and importance of teams improving their fast break scoring. The champion Warriors have led the statistics the past 3 seasons, and barring the 3-1 collapse, have produced 3 championship seasons.
Further research wise when looking at this project from a big picture is that data science will always prove beneficial and vital in improving quality of teams and athlete's performance in regards to sports. And it will only grow because even through simple models such as these one can see that the 4th Quarter margin does not mean as much as the amount of fast break points a team is producing per game.
Little things like this and the little edge that teams, coaches, scouts, and executives are all looking for and crave can and will all be produced through data science. With it providing a constantly new and innovative way to look at what was perceived in the past as bland and concrete statistics in a more complex and alternative way.