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
-
property
data
¶ returns event as a dict
-
property
is_possession_ending_event
¶ returns True if event ends a possession, False otherwise
-
property
seconds_remaining
¶ returns seconds remaining in period as a
float
-
property
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]¶
-
property
is_made
¶ returns True if shot was made, False otherwise
-
property
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¶
-
property
is_away_from_play_foul
¶
-
property
is_charge
¶
-
property
is_clear_path_foul
¶
-
property
is_defensive_3_seconds
¶
-
property
is_delay_of_game
¶
-
property
is_double_foul
¶
-
property
is_double_technical
¶
-
property
is_flagrant1
¶
-
property
is_flagrant2
¶
-
property
is_inbound_foul
¶
-
property
is_loose_ball_foul
¶
-
property
is_offensive_foul
¶
-
property
is_personal_block_foul
¶
-
property
is_personal_foul
¶
-
property
is_personal_take_foul
¶
-
property
is_shooting_block_foul
¶
-
property
is_shooting_foul
¶
-
property
is_technical
¶
-
property
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¶
-
property
is_ft_1_of_1
¶
-
property
is_ft_1_of_2
¶
-
property
is_ft_1_of_3
¶
-
property
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
-
property
is_ft_2_of_2
¶
-
property
is_ft_2_of_3
¶
-
property
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
-
property
is_ft_3_of_3
¶
-
property
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
-
property
is_made
¶ returns True if shot was made, False otherwise
-
property
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¶
-
property
is_placeholder
¶ returns True if rebound is a placeholder event, False otherwise.
These are team rebounds on for example missed FT 1 of 2
-
property
missed_shot
¶ returns
FieldGoal
orFreeThrow
object for shot that was missed- Raises
EventOrderError
: If rebound event is not immediately following a missed shot event.
-
property
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¶
-
property
overturn_ruling
¶
-
property
ruling_stands
¶
-
property
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.
-
property
league_url_part
¶
-
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¶
-
property
incoming_player_id
¶ returns player id of player coming in to the game
-
property
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¶
-
property
is_3_second_violation
¶
-
property
is_bad_pass
¶
-
property
is_bad_pass_out_of_bounds
¶
-
property
is_kicked_ball
¶
-
property
is_lane_violation
¶
-
property
is_lost_ball
¶
-
property
is_lost_ball_out_of_bounds
¶
-
property
is_no_turnover
¶
-
property
is_offensive_goaltending
¶
-
property
is_shot_clock_violation
¶
-
property
is_step_out_of_bounds
¶
-
property
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¶
-
property
is_delay_of_game
¶
-
property
is_double_lane_violation
¶
-
property
is_goaltend_violation
¶
-
property
is_jumpball_violation
¶
-
property
is_kicked_ball_violation
¶
-
property
is_lane_violation
¶
-