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.StatsNbaLoaderBaseLoads stats.nba.com source boxscore data for game. Team/Player data is stored in items attribute as
StatsNbaBoxscoreItemobjectsParameters: - game_id (str) – NBA Stats Game Id
- source_loader –
StatsNbaBoxscoreFileLoaderorStatsNbaBoxscoreWebLoaderobject
-
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.StatsNbaFileLoaderA
StatsNbaBoxscoreFileLoaderobject should be instantiated and passed intoStatsNbaBoxscoreLoaderwhen loading data from fileParameters: 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.
-
class
pbpstats.data_loader.stats_nba.boxscore.web.StatsNbaBoxscoreWebLoader(file_directory=None)[source]¶ Bases:
pbpstats.data_loader.stats_nba.web_loader.StatsNbaWebLoaderA
StatsNbaBoxscoreWebLoaderobject should be instantiated and passed intoStatsNbaBoxscoreLoaderwhen loading data directly from the NBA Stats APIParameters: 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.