Boxscore

StatsNbaBoxscoreLoader loads boxscore data for a game and creates StatsNbaBoxscoreItem objects for each player and team

The following code will load boxscore data for game id “0021900001” from a file located in a subdirectory of the /data directory

from pbpstats.data_loader import StatsNbaBoxscoreFileLoader, StatsNbaBoxscoreLoader

source_loader = StatsNbaBoxscoreFileLoader("/data")
boxscore_loader = StatsNbaBoxscoreLoader("0021900001", source_loader)
print(boxscore_loader.items[0].data) # prints dict with a player's boxscore data for game
class pbpstats.data_loader.stats_nba.boxscore.loader.StatsNbaBoxscoreLoader(game_id, source_loader)[source]

Bases: pbpstats.data_loader.stats_nba.base.StatsNbaLoaderBase

Loads stats.nba.com source boxscore data for game. Team/Player data is stored in items attribute as StatsNbaBoxscoreItem objects

Parameters:
data_provider = 'stats_nba'
parent_object = 'Game'
resource = 'Boxscore'
class pbpstats.data_loader.stats_nba.boxscore.file.StatsNbaBoxscoreFileLoader(file_directory)[source]

Bases: pbpstats.data_loader.stats_nba.file_loader.StatsNbaFileLoader

A StatsNbaBoxscoreFileLoader object should be instantiated and passed into StatsNbaBoxscoreLoader when loading data from file

Parameters:file_directory (str) – Directory in which data should be loaded from. The specific file location will be stats_boxscore_<game_id>.json in the /game_details subdirectory.
load_data(game_id)[source]
class pbpstats.data_loader.stats_nba.boxscore.web.StatsNbaBoxscoreWebLoader(file_directory=None)[source]

Bases: pbpstats.data_loader.stats_nba.web_loader.StatsNbaWebLoader

A StatsNbaBoxscoreWebLoader object should be instantiated and passed into StatsNbaBoxscoreLoader when loading data directly from the NBA Stats API

Parameters:file_directory (str) – (optional, use it if you want to store the response data on disk) Directory in which data should be either stored. The specific file location will be stats_boxscore_<game_id>.json in the /game_details subdirectory. If not provided response data will not be saved on disk.
load_data(game_id)[source]