Loading...
NBA Data Analysis:
Do Birthdays Affect Player Performance?
-In this Dataset I will explore NBA Data from the past 5 seasons of games and try to find out if player performance is changes when it is a player's birthday
Background Info:
- This data takes a look at the top 12 players per team based on total minutes
I chose to do this to remove some outliers of players who may on rarely play or do not get consistent minutes
- This data will explore three main statistical categories
Minutes Played: The amount of minutes played has a big impact on cumulative statistics like points, rebounds, assists, ect.
PRASB: A self created stat that is the sum of points, rebounds, assists, steals, and blocks combined
FG_PCT: Field goal percentage tracks the percentage of made shots divided by total shots. It is a crucial stat in tracking player efficiency
- I chose to examine players stats on the day of their birthday
Interested in seeing if players will have a boost in confidence or a change in their minutes patterns
- I chose to examine players stats on the day after their birthday as well
People like to celebrate their birthdays
Interested in seeing if there is a birthday hangover effect that causes stats to drop off
Retrieving Data:
-I pulled in my data from the official NBA API for player and team statistics 'nba_api' and converted them to CSV files to be used in this notebook
-API stands for "Application Programming Interface"
Allows for users to make calls and receive live data in real time
-I used it to pull in 4 separate datasets
mpg_df: Dataset that displays overall minutes played and minutes per game for each NBA player within the past 5 years
top_12_players_per_team: Dataset that narrows down mpg_df to the top 12 players from each team based on minutes and season
all_game_logs: Dataset that shows box scores for every game played by a player from top_12_players_per_team
aggregated stats: Dataset that returns the players statistical averages for each of the 5 seasons
Installing/Importing Packages:
Reading in my CSV Files as Dataframes:
mpg_df["PLAYER_NAME"].count()
#look at the dataframes
mpg_df.head()
top_12_players_per_team['PLAYER_NAME'].count()
top_12_players_per_team.head()
#Graph displaying top_12_players_per_team dataset and its 1,800 data points
fig_1.show()
Dropping Duplicate Values:
Data Analysis:
First Step was to compile a dataframe of players stats on their birthdays and average them by season
bday_yearly_avgs.head()
Next we need gather the same players season averages to compare with:
Showing the % difference in games played on birthdays and their season averages
# Percent Difference Between Games Played on Birthdays and Regular Season Averages plot
fig_2.show()
#Percent Difference Between Games Played Day After Your Birthdays and Regular Season Averages
fig_3.show()
Lets compare Performances on Birthdays to their previous 10 game averages
Entire season averages might not be a perfect fit
Over the course of an entire season averages smooth out
Previous 10 game average might be a better fit to show if a birthday provides a significant jump in performance
Showing the % differences between games played on birthdays and previous 10 game averages
# Percent Difference Between Games Played on Birthdays and Previous 10 Game Averages plot
fig_4.show()
# Percent Difference Between Games Played the Day After your Birthday and Previous 10 Game Averages
fig_5.show()
Loading...
Takeaways:
From these results it is tough to say if a players birthday affects their performance
The percent differences are within the normal variance of game-to-game statistics
More Research would need to be done
combined_df
What I would do going forward:
Separate players by age and see if maturity and experience possibly plays a role
Break down data by day of week. If the players birthday is on a weeknight they likely aren't celebrating until the weekend
Drill into specific patterns by team. Head coaches usually control minute patterns and may treat birthdays differently
Skills I applied from our Data Science Class:
Python Coding
Implementation of Python Packages
How to use an API
Data Cleaning
Data Visualizations
Statistical Analysis
Creation of a Web Application using Deepnote