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.DataEnhancedPbpItem
Class 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.DataEnhancedPbpItem
Class 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.EnhancedPbpItem
Base 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
-
property
data
¶ returns event as a dict
-
property
event_stats
¶ returns list of dicts with all stats for event
-
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
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.DataEnhancedPbpItem
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.data_nba.foul.
DataFoul
(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.foul.Foul
,pbpstats.resources.enhanced_pbp.data_nba.enhanced_pbp_item.DataEnhancedPbpItem
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.data_nba.free_throw.
DataFreeThrow
(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.free_throw.FreeThrow
,pbpstats.resources.enhanced_pbp.data_nba.enhanced_pbp_item.DataEnhancedPbpItem
Class for free throw events
-
event_type
= 3¶
-
property
is_flagrant_ft
¶
-
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.data_nba.jump_ball.
DataJumpBall
(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.jump_ball.JumpBall
,pbpstats.resources.enhanced_pbp.data_nba.enhanced_pbp_item.DataEnhancedPbpItem
Class 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.DataEnhancedPbpItem
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.data_nba.replay.
DataReplay
(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.replay.Replay
,pbpstats.resources.enhanced_pbp.data_nba.enhanced_pbp_item.DataEnhancedPbpItem
Class for replay events
-
event_type
= 18¶
-
property
overturn_ruling
¶
-
property
ruling_stands
¶
-
property
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.DataEnhancedPbpItem
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.data_nba.substitution.
DataSubstitution
(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.substitution.Substitution
,pbpstats.resources.enhanced_pbp.data_nba.enhanced_pbp_item.DataEnhancedPbpItem
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.data_nba.timeout.
DataTimeout
(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.timeout.Timeout
,pbpstats.resources.enhanced_pbp.data_nba.enhanced_pbp_item.DataEnhancedPbpItem
Class 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.DataEnhancedPbpItem
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.data_nba.violation.
DataViolation
(*args)[source]¶ Bases:
pbpstats.resources.enhanced_pbp.violation.Violation
,pbpstats.resources.enhanced_pbp.data_nba.enhanced_pbp_item.DataEnhancedPbpItem
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
¶
-