Boxscore¶
LiveBoxscoreLoader
loads boxscore data for a game and creates LiveBoxscoreItem
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 LiveBoxscoreFileLoader, LiveBoxscoreLoader
source_loader = LiveBoxscoreFileLoader("/data")
boxscore_loader = LiveBoxscoreLoader("0021900001", source_loader)
print(boxscore_loader.items[0].data) # prints dict with a player's boxscore data for game
-
class
pbpstats.data_loader.live.boxscore.loader.
LiveBoxscoreLoader
(game_id, source_loader)[source]¶ Bases:
pbpstats.data_loader.live.base.LiveLoaderBase
Loads data.nba.com source boxscore data for game. Team/Player data is stored in items attribute as
LiveBoxscoreItem
objectsParameters: - game_id (str) – NBA Stats Game Id
- source_loader –
LiveBoxscoreFileLoader
orLiveBoxscoreWebLoader
object
-
data
¶ returns raw JSON response data
-
data_provider
= 'live'¶
-
parent_object
= 'Game'¶
-
resource
= 'Boxscore'¶
-
class
pbpstats.data_loader.live.boxscore.file.
LiveBoxscoreFileLoader
(file_directory)[source]¶ Bases:
pbpstats.data_loader.live.file_loader.LiveFileLoader
A
LiveBoxscoreFileLoader
object should be instantiated and passed intoLiveBoxscoreLoader
when loading data from fileParameters: file_directory (str) – Directory in which data should be loaded from. The specific file location will be live_<game_id>.json in the /game_details subdirectory.
-
class
pbpstats.data_loader.live.boxscore.web.
LiveBoxscoreWebLoader
(file_directory=None)[source]¶ Bases:
pbpstats.data_loader.live.web_loader.LiveWebLoader
LiveBoxscoreWebLoader
object should be instantiated and passed intoLiveBoxscoreLoader
when 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 live_<game_id>.json in the /game_details subdirectory. If not provided response data will not be saved on disk.