Canada Basketball Analytics

How to pull NBA Shot Chart Data

We’d like to cover off how to pull NBA shot chart data using the NBA_API and Python. In this example, we are looking at Jamal Murray’s shot chart from his game on Feb. 27th, 2021 against OKC.

Some prerequisites before continuing are to have Anaconda or some sort of way to develop Python code.

Anaconda

Anaconda is a free and open-source distribution of the Python and R programming languages for scientific computing that aims to simplify package management and deployment. To download and install please visit the Anaconda homepage.

NBA_API

NBA_API is an API Client package to access the APIs for NBA.com. To install you can use the below command

pip install nba_api

For more information around NBA_API, check them out on GitHub.

The Code

Also available via GitHub.