wsba_hockey.tools package
Submodules
wsba_hockey.tools.agg module
wsba_hockey.tools.globals module
wsba_hockey.tools.http module
wsba_hockey.tools.plotting module
- class wsba_hockey.tools.plotting.WSBAPlot(display_range: str = 'full', rotation: int | None = 0, figsize=(10, 12), facecolor='w', edgecolor='k')[source]
Bases:
object
- wsba_hockey.tools.plotting.apply_primary_colors(df: DataFrame, color_map: dict[str, str], *, team_abbr_col: str = 'event_team_abbr', season_col: str = 'season', out_col: str = 'color', fallback: str = '#1f77b4') DataFrame[source]
- wsba_hockey.tools.plotting.load_teaminfo(info_path: str = '/home/runner/work/wsba_hockey/wsba_hockey/src/wsba_hockey/tools/teaminfo/nhl_teaminfo.csv') DataFrame[source]
- wsba_hockey.tools.plotting.plot_events(pbp: DataFrame, events: list[str], title: str | None = None, marker_dict: dict | None = None, legend: bool = False, display_range: str = 'full', rotation: int | None = 0, figsize=(6.4, 4.8))[source]
- wsba_hockey.tools.plotting.prep_plot_data(pbp, strengths, season_types=2, marker_dict={'blocked-shot': 'v', 'faceoff': 'X', 'giveaway': '1', 'goal': '*', 'hit': 'P', 'missed-shot': 'o', 'shot-on-goal': 'D', 'takeaway': '2'})[source]
wsba_hockey.tools.scraping module
wsba_hockey.tools.xg_model module
- wsba_hockey.tools.xg_model.nhl_apply_xG(pbp: DataFrame, states: bool = False) DataFrame[source]
Given play-by-play data, return this data with xG-related columns.
- Parameters:
pbp (pd.DataFrame) – A DataFrame containing play-by-play data generated within the WBSA Hockey package.
states (bool, optional) – If True, recalculate score, Corsi, Fenwick, and penalty states before applying xG. Defaults to False, matching the previous xG module behavior.
- Returns:
A DataFrame containing input play-by-play data with xG column.
- Return type:
pd.DataFrame