Skip to content
This repository was archived by the owner on Jul 1, 2021. It is now read-only.
jtpavlock edited this page Dec 22, 2019 · 4 revisions

Usage

All data is returned as a pandas dataframe (check out the starter docs if you're new to pandas). For example:

from nbapy import game
import pandas as pd

game_id = '0021900017'  # taken from 'https://stats.nba.com/game/0021900017/'
stats = pd.DataFrame(game.BoxScore(game_id).players_stats())

If you want to cache results so you don't have to reach the api every time, you can use requests-cache

from nbapy import game
import pandas as pd
import requests_cache

requests_cache.install_cache('nbapy_cache')

game_id = '0021900017'
stats = pd.DataFrame(game.BoxScore(game_id).players_stats())

Clone this wiki locally