Possessions

Possession

The Possession class has some basic properties for handling possession data

class pbpstats.resources.possessions.possession.Possession(events)[source]

Bases: object

Class for possession

Parameters:events (list) – list of EnhancedPbpItem items for possession, typically from a possession data loader
data

returns dict possession data

end_time

returns the time remaining (MM:SS) in the period when the possession ended

get_team_ids()[source]

returns a list with the team ids of both teams playing

offense_team_id

returns team id for team on offense on possession

possession_has_timeout

returns True if there was a timeout called on the current possession, False otherwise

possession_start_type

returns possession start type string

possession_stats

returns list of dicts with aggregate stats for possession

previous_possession_end_rebound_player_id

returns player id of player who got rebound that ended previous possession. returns 0 if previous possession did not end with a live ball rebound

previous_possession_end_shooter_player_id

returns player id of player who took shot (make or miss) that ended previous possession. returns 0 if previous possession did not end with made field goal or live ball rebound

previous_possession_end_steal_player_id

returns player id of player who got steal that ended previous possession. returns 0 if previous possession did not end with a live ball turnover

previous_possession_end_turnover_player_id

returns player id of player who turned ball over that ended previous possession. returns 0 if previous possession did not end with a live ball turnover

previous_possession_ending_event

returns previous possession ending event - ignoring subs

previous_possession_has_timeout

returns True if there was a timeout called at same time as possession ended, False otherwise

start_score_margin

returns the score margin from the perspective of the team on offense when the possession started

start_time

returns the time remaining (MM:SS) in the period when the possession started

Possessions

The Possessions class has some basic properties for aggregating possession stats

class pbpstats.resources.possessions.possessions.Possessions(items)[source]

Bases: pbpstats.resources.base.Base

Class for possession items

Parameters:items (list) – list of Possession items, typically from a possession data loader
data

returns possessions dict

lineup_opponent_stats

returns list of dicts with aggregated stats by lineup opponent

lineup_stats

returns list of dicts with aggregated stats by lineup

opponent_stats

returns list of dicts with aggregated stats by opponent

player_stats

returns list of dicts with aggregated stats by player

team_stats

returns list of dicts with aggregated stats by team