This is a tutorial for how to use the pbpstats Python package to pull all of the relevant data for calculating RAPM. The tutorial is written for the NBA, though the package should be able to pull the data for the WNBA and G League, if you wish to do so. It only covers pulling and transforming the data as Ryan Davis has already written an excellent tutorial for calculating RAPM once the data is in this format. The full tutorial and code may be found in the Jupyter notebook file.
If you wish to run it yourself, you may clone or fork the repository. I use pipenv to manage the packages and environment and included a Pipfile for installing all of the relevant packages. It specifies the Python version as 3.7.1
, but it should run on anything above 3.6
.
- Put the Python code in
.py
files in addition to the notebooks.