data.nba.com Enhanced PBP¶
Ejection¶
-
class
pbpstats.resources.enhanced_pbp.data_nba.ejection.DataEjection(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.ejection.Ejection,pbpstats.resources.enhanced_pbp.data_nba.enhanced_pbp_item.DataEnhancedPbpItemClass for Ejection events
-
event_type= 11¶
-
End of Period¶
-
class
pbpstats.resources.enhanced_pbp.data_nba.end_of_period.DataEndOfPeriod(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.end_of_period.EndOfPeriod,pbpstats.resources.enhanced_pbp.data_nba.enhanced_pbp_item.DataEnhancedPbpItemClass for end of period events
-
event_type= 13¶
-
Enhanced PBP Factory¶
DataNbaEnhancedPbpFactory can be used to create enhanced pbp event objects from
the pbpstats.resources.enhanced_pbp.data_nba module based on the event type.
The following code will get the event class for event type 1 (which is the event type for a field goal make)
from pbpstats.resources.enhanced_pbp.data_nba.enhanced_pbp_factory import DataNbaEnhancedPbpFactory
factory = DataNbaEnhancedPbpFactory()
event_class = factory.get_event_class(1)
print(event_class) # prints "<class 'pbpstats.resources.enhanced_pbp.data_nba.field_goal.DataFieldGoal'>"
Enhanced PBP Item¶
DataEnhancedPbpItem is the base class for all data.nba.com enhanced pbp event types
-
class
pbpstats.resources.enhanced_pbp.data_nba.enhanced_pbp_item.DataEnhancedPbpItem(item, period, game_id)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.enhanced_pbp_item.EnhancedPbpItemBase class for enhanced pbp events from data.nba.com
Parameters: - item (dict) – dict with event data
- period (int) – period in which event occurs
- game_id (str) – NBA Stats Game Id
-
data¶ returns event as a dict
-
event_stats¶ returns list of dicts with all stats for event
-
is_possession_ending_event¶ returns True if event ends a possession, False otherwise
-
seconds_remaining¶ returns seconds remaining in period as a
float
Field Goal¶
-
class
pbpstats.resources.enhanced_pbp.data_nba.field_goal.DataFieldGoal(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.field_goal.FieldGoal,pbpstats.resources.enhanced_pbp.data_nba.enhanced_pbp_item.DataEnhancedPbpItemClass for field goal events
-
event_type= [1, 2]¶
-
is_made¶ returns True if shot was made, False otherwise
-
shot_value¶ returns 3 if shot is a 3 point attempt, 2 otherwise
-
Foul¶
-
class
pbpstats.resources.enhanced_pbp.data_nba.foul.DataFoul(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.foul.Foul,pbpstats.resources.enhanced_pbp.data_nba.enhanced_pbp_item.DataEnhancedPbpItemClass for foul events
-
event_type= 6¶
-
is_away_from_play_foul¶
-
is_charge¶
-
is_clear_path_foul¶
-
is_defensive_3_seconds¶
-
is_delay_of_game¶
-
is_double_foul¶
-
is_double_technical¶
-
is_flagrant1¶
-
is_flagrant2¶
-
is_inbound_foul¶
-
is_loose_ball_foul¶
-
is_offensive_foul¶
-
is_personal_block_foul¶
-
is_personal_foul¶
-
is_personal_take_foul¶
-
is_shooting_block_foul¶
-
is_shooting_foul¶
-
is_technical¶
-
is_transition_take_foul¶
-
number_of_fta_for_foul¶ returns the number of free throws resulting from the foul
-
Free Throw¶
-
class
pbpstats.resources.enhanced_pbp.data_nba.free_throw.DataFreeThrow(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.free_throw.FreeThrow,pbpstats.resources.enhanced_pbp.data_nba.enhanced_pbp_item.DataEnhancedPbpItemClass for free throw events
-
event_type= 3¶
-
is_flagrant_ft¶
-
is_ft_1_of_1¶
-
is_ft_1_of_2¶
-
is_ft_1_of_3¶
-
is_ft_1pt¶ returns True if free throw is a 1 point free throw, False otherwise Only used in g-league, starting in 2019-20 season
-
is_ft_2_of_2¶
-
is_ft_2_of_3¶
-
is_ft_2pt¶ returns True if free throw is a 2 point free throw, False otherwise Only used in g-league, starting in 2019-20 season
-
is_ft_3_of_3¶
-
is_ft_3pt¶ returns True if free throw is a 3 point free throw, False otherwise Only used in g-league, starting in 2019-20 season
-
is_made¶ returns True if shot was made, False otherwise
-
is_technical_ft¶
-
Jump Ball¶
-
class
pbpstats.resources.enhanced_pbp.data_nba.jump_ball.DataJumpBall(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.jump_ball.JumpBall,pbpstats.resources.enhanced_pbp.data_nba.enhanced_pbp_item.DataEnhancedPbpItemClass for jump ball events
-
event_type= 10¶
-
Rebound¶
-
class
pbpstats.resources.enhanced_pbp.data_nba.rebound.DataRebound(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.rebound.Rebound,pbpstats.resources.enhanced_pbp.data_nba.enhanced_pbp_item.DataEnhancedPbpItemClass for rebound events
-
event_type= 4¶
-
is_placeholder¶ returns True if rebound is a placeholder event, False otherwise.
These are team rebounds on for example missed FT 1 of 2
-
missed_shot¶ returns
FieldGoalorFreeThrowobject for shot that was missedRaises: EventOrderError: If rebound event is not immediately following a missed shot event.
-
oreb¶ returns True if rebound is an offensive rebound, False otherwise
-
Replay¶
-
class
pbpstats.resources.enhanced_pbp.data_nba.replay.DataReplay(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.replay.Replay,pbpstats.resources.enhanced_pbp.data_nba.enhanced_pbp_item.DataEnhancedPbpItemClass for replay events
-
event_type= 18¶
-
overturn_ruling¶
-
ruling_stands¶
-
support_ruling¶
-
Start of Period¶
-
class
pbpstats.resources.enhanced_pbp.data_nba.start_of_period.DataStartOfPeriod(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.start_of_period.StartOfPeriod,pbpstats.resources.enhanced_pbp.data_nba.enhanced_pbp_item.DataEnhancedPbpItemClass for start of period events
-
event_type= 12¶
-
get_period_starters(file_directory=None)[source]¶ Gets player ids of players who started the period for each team If players can’t be determined from parsing pbp, will try to find them by making API request to stats.nba.com boxscore filtered by time.
Parameters: file_directory (str) – directory in which overrides subdirectory exists containing period starter overrides when period starters can’t be determined from parsing pbp events Returns: dict with list of player ids for each team with players on the floor at start of period Raises: InvalidNumberOfStartersException: If all 5 players that start the period for a team can’t be determined.
-
Substitution¶
-
class
pbpstats.resources.enhanced_pbp.data_nba.substitution.DataSubstitution(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.substitution.Substitution,pbpstats.resources.enhanced_pbp.data_nba.enhanced_pbp_item.DataEnhancedPbpItemClass for Substitution events
-
event_type= 8¶
-
incoming_player_id¶ returns player id of player coming in to the game
-
outgoing_player_id¶ returns player id of player going out of the game
-
Timeout¶
-
class
pbpstats.resources.enhanced_pbp.data_nba.timeout.DataTimeout(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.timeout.Timeout,pbpstats.resources.enhanced_pbp.data_nba.enhanced_pbp_item.DataEnhancedPbpItemClass for timeout events
-
event_type= 9¶
-
Turnover¶
-
class
pbpstats.resources.enhanced_pbp.data_nba.turnover.DataTurnover(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.turnover.Turnover,pbpstats.resources.enhanced_pbp.data_nba.enhanced_pbp_item.DataEnhancedPbpItemClass for Turnover events
-
event_type= 5¶
-
is_3_second_violation¶
-
is_bad_pass¶
-
is_bad_pass_out_of_bounds¶
-
is_kicked_ball¶
-
is_lane_violation¶
-
is_lost_ball¶
-
is_lost_ball_out_of_bounds¶
-
is_no_turnover¶
-
is_offensive_goaltending¶
-
is_shot_clock_violation¶
-
is_step_out_of_bounds¶
-
is_travel¶
-
Violation¶
-
class
pbpstats.resources.enhanced_pbp.data_nba.violation.DataViolation(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.violation.Violation,pbpstats.resources.enhanced_pbp.data_nba.enhanced_pbp_item.DataEnhancedPbpItemClass for violation events
-
event_type= 7¶
-
is_delay_of_game¶
-
is_double_lane_violation¶
-
is_goaltend_violation¶
-
is_jumpball_violation¶
-
is_kicked_ball_violation¶
-
is_lane_violation¶
-