Boxscore¶
StatsNbaGameFinderLoader
loads all games for a season and
creates StatsNbaGameItem
objects for each game
The following code will load data for the 2019-20 NBA Regular Season
from pbpstats.data_loader import StatsNbaGameFinderWebLoader, StatsNbaGameFinderLoader
source_loader = StatsNbaGameFinderWebLoader("/data")
game_finder_loader = StatsNbaGameFinderLoader("nba", "2019-20", "Regular Season", source_loader)
print(game_finder_loader.items[0].data) # prints dict for first game
-
class
pbpstats.data_loader.stats_nba.game_finder.loader.
StatsNbaGameFinderLoader
(league, season, season_type, source_loader)[source]¶ Bases:
pbpstats.data_loader.stats_nba.base.StatsNbaLoaderBase
Loads stats.nba.com source data for season. Games are stored in items attribute as
StatsNbaGameItem
objects- Parameters
league (str) – Options are ‘nba’, ‘wnba’ or ‘gleague’
season (str) – Formatted as 2019-20 for NBA and G-League, 2019 of WNBA.
season_type (str) – Options are ‘Regular Season’ or ‘Playoffs’ or ‘Play In’
source_loader –
StatsNbaGameFinderFileLoader
orStatsNbaGameFinderWebLoader
object
-
data_provider
= 'stats_nba'¶
-
parent_object
= 'Season'¶
-
resource
= 'Games'¶
-
class
pbpstats.data_loader.stats_nba.game_finder.file.
StatsNbaGameFinderFileLoader
(file_directory)[source]¶ Bases:
pbpstats.data_loader.stats_nba.file_loader.StatsNbaFileLoader
A
StatsNbaGameFinderFileLoader
object should be instantiated and passed intoStatsNbaGameFinderLoader
when loading data from file- Parameters
file_directory (str) – Directory in which data should be loaded from. The specific file location will be stats_<league>_<season>_<season_type>.json in the /schedule subdirectory.
-
class
pbpstats.data_loader.stats_nba.game_finder.web.
StatsNbaGameFinderWebLoader
(file_directory=None)[source]¶ Bases:
pbpstats.data_loader.stats_nba.web_loader.StatsNbaWebLoader
A
StatsNbaGameFinderWebLoader
object should be instantiated and passed intoStatsNbaGameFinderLoader
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_<league>_<season>_<season_type>.json in the /schedule subdirectory. If not provided response data will not be saved on disk.