This Python script allows you to analyze and calculate the standard deviation of counting statistics for a specific NBA player in a given season. It fetches data from the website "basketball-reference.com" based on the player's name and the desired year, processes the data, and presents the mean and standard deviation of various statistical categories.
To run this script, you'll need:
- Python installed on your system.
- The
requestslibrary for making HTTP requests. - The
pandaslibrary for data manipulation and analysis.
You can install the required libraries using the following commands:
pip install requests
pip install pandas-
Open a terminal and navigate to the directory containing the
playerStatAnalysis.pyscript. -
Make the script executable if necessary. Run the following command:
chmod +x playerStatAnalysis.py
-
Run the script using the command:
./playerStatAnalysis.py
-
Follow the prompts to input the NBA player's name and the desired season.
-
The script will fetch player's game log data from "basketball-reference.com," process it, and calculate the mean and standard deviation of various counting statistics.
-
The output will display the player's name, the specified season, mean statistics, and standard deviation statistics for the relevant counting categories.
- Fetches game log data for a specific NBA player in a given season from an external website.
- Calculates the mean and standard deviation of counting statistics such as field goals, three-pointers, free throws, rebounds, assists, steals, blocks, turnovers, and more.
Please be aware that the script fetches data from an external website, and its functionality might be affected if the website's structure or data format changes. The script may need adjustments in such cases.
This script is provided as-is and may not have full error handling or extensive testing. Use it responsibly and feel free to modify it to suit your needs.
For more information about the script's implementation and functions, refer to the script's comments and the pandas documentation.
Author: Leo Chao
Date: 2023/08/13