stats.nba.com Enhanced PBP¶
Ejection¶
-
class
pbpstats.resources.enhanced_pbp.stats_nba.ejection.
StatsEjection
(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.ejection.Ejection
,pbpstats.resources.enhanced_pbp.stats_nba.enhanced_pbp_item.StatsEnhancedPbpItem
Class for Ejection events
-
event_type
= 11¶
-
End of Period¶
-
class
pbpstats.resources.enhanced_pbp.stats_nba.end_of_period.
StatsEndOfPeriod
(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.end_of_period.EndOfPeriod
,pbpstats.resources.enhanced_pbp.stats_nba.enhanced_pbp_item.StatsEnhancedPbpItem
Class for end of period events
-
event_type
= 13¶
-
Enhanced PBP Factory¶
StatsNbaEnhancedPbpFactory
can be used to create enhanced pbp event objects from
the pbpstats.resources.enhanced_pbp.stats_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.stats_nba.enhanced_pbp_factory import StatsNbaEnhancedPbpFactory
factory = StatsNbaEnhancedPbpFactory()
event_class = factory.get_event_class(1)
print(event_class) # prints "<class 'pbpstats.resources.enhanced_pbp.stats_nba.field_goal.StatsFieldGoal'>"
Enhanced PBP Item¶
StatsEnhancedPbpItem
is the base class for all stats.nba.com enhanced pbp event types
-
class
pbpstats.resources.enhanced_pbp.stats_nba.enhanced_pbp_item.
StatsEnhancedPbpItem
(event, order)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.enhanced_pbp_item.EnhancedPbpItem
Base class for enhanced pbp events from stats.nba.com
Parameters: - event (dict) – dict with event data
- order (int) – sequential order in which event occurs
-
data
¶ returns event as a dict
-
is_possession_ending_event
¶ returns True if event ends a possession, False otherwise
-
seconds_remaining
¶ returns seconds remaining in period as a
float
-
video_url
¶ returns url for mp4 video of play, if available
Field Goal¶
-
class
pbpstats.resources.enhanced_pbp.stats_nba.field_goal.
StatsFieldGoal
(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.field_goal.FieldGoal
,pbpstats.resources.enhanced_pbp.stats_nba.enhanced_pbp_item.StatsEnhancedPbpItem
Class 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.stats_nba.foul.
StatsFoul
(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.foul.Foul
,pbpstats.resources.enhanced_pbp.stats_nba.enhanced_pbp_item.StatsEnhancedPbpItem
Class 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.stats_nba.free_throw.
StatsFreeThrow
(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.free_throw.FreeThrow
,pbpstats.resources.enhanced_pbp.stats_nba.enhanced_pbp_item.StatsEnhancedPbpItem
Class 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.stats_nba.jump_ball.
StatsJumpBall
(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.jump_ball.JumpBall
,pbpstats.resources.enhanced_pbp.stats_nba.enhanced_pbp_item.StatsEnhancedPbpItem
Class for jump ball events
-
event_type
= 10¶
-
Rebound¶
-
class
pbpstats.resources.enhanced_pbp.stats_nba.rebound.
StatsRebound
(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.rebound.Rebound
,pbpstats.resources.enhanced_pbp.stats_nba.enhanced_pbp_item.StatsEnhancedPbpItem
Class 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
FieldGoal
orFreeThrow
object 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.stats_nba.replay.
StatsReplay
(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.replay.Replay
,pbpstats.resources.enhanced_pbp.stats_nba.enhanced_pbp_item.StatsEnhancedPbpItem
Class for replay events
-
event_type
= 18¶
-
overturn_ruling
¶
-
ruling_stands
¶
-
support_ruling
¶
-
Start of Period¶
-
class
pbpstats.resources.enhanced_pbp.stats_nba.start_of_period.
StatsStartOfPeriod
(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.start_of_period.StartOfPeriod
,pbpstats.resources.enhanced_pbp.stats_nba.enhanced_pbp_item.StatsEnhancedPbpItem
Class 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.stats_nba.substitution.
StatsSubstitution
(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.substitution.Substitution
,pbpstats.resources.enhanced_pbp.stats_nba.enhanced_pbp_item.StatsEnhancedPbpItem
Class 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.stats_nba.timeout.
StatsTimeout
(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.timeout.Timeout
,pbpstats.resources.enhanced_pbp.stats_nba.enhanced_pbp_item.StatsEnhancedPbpItem
Class for timeout events
-
event_type
= 9¶
-
Turnover¶
-
class
pbpstats.resources.enhanced_pbp.stats_nba.turnover.
StatsTurnover
(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.turnover.Turnover
,pbpstats.resources.enhanced_pbp.stats_nba.enhanced_pbp_item.StatsEnhancedPbpItem
Class 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.stats_nba.violation.
StatsViolation
(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.violation.Violation
,pbpstats.resources.enhanced_pbp.stats_nba.enhanced_pbp_item.StatsEnhancedPbpItem
Class 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
¶
-