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

property data

returns dict possession data

property 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

property offense_team_id

returns team id for team on offense on possession

property possession_has_timeout

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

property possession_start_type

returns possession start type string

property possession_stats

returns list of dicts with aggregate stats for possession

property 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

property 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

property 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

property 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

property previous_possession_ending_event

returns previous possession ending event - ignoring subs

property previous_possession_has_timeout

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

property start_score_margin

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

property 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

property data

returns possessions dict

property lineup_opponent_stats

returns list of dicts with aggregated stats by lineup opponent

property lineup_stats

returns list of dicts with aggregated stats by lineup

property opponent_stats

returns list of dicts with aggregated stats by opponent

property player_stats

returns list of dicts with aggregated stats by player

property team_stats

returns list of dicts with aggregated stats by team