WSBA HOCKEY
A Python package for scraping and analyzing hockey data under the motto: Evaluating, analyzing, and understanding the game of hockey through the lens of different analytical methods.
INSTALLATION AND USAGE
pip install wsba_hockey
import wsba_hockey as wsba
ALL FEATURES
SCRAPING
NHL Play-by-Play (of any game frame up to a full season)
Functions:
wsba.nhl_scrape_game(2024020918,split_shifts=False,remove=['game-end'])
wsba.nhl_scrape_season(20242025,split_shifts=False,remove=['game-end'],local=True)
Reusing Scrapy-backed Sessions
import wsba_hockey as wsba
with wsba.make_pooled_session() as session:
games = [2024020918, 2024020919]
pbp = [wsba.nhl_scrape_game(game, session=session) for game in games]
The session uses Scrapy internally while preserving the package's synchronous API. Scrapy remote control is disabled because it is not used by the client.
NHL Season Information
wsba.nhl_scrape_schedule(20242025)
wsba.nhl_scrape_seasons_info(seasons=[20212022,20222023,20232024,20242025])
wsba.nhl_scrape_standings()
NHL Rosters and Player Information
wsba.nhl_scrape_roster(20242025)
wsba.nhl_scrape_player_info([8477956, 8479987])
wsba.nhl_scrape_team_info()
NHL Draft Rankings and Prospects
wsba.nhl_scrape_draft_rankings()
wsba.nhl_scrape_prospects('BOS')
NHL EDGE Data
wsba.nhl_scrape_edge(20252026,'skater',[8477956, 8479987])
wsba.nhl_scrape_edge(20252026,'goalie',[8480280])
wsba.nhl_scrape_edge(20252026,'team',['BOS'])
NHL Event Tracking Data
wsba.nhl_scrape_event_data({2023020001: [101, 102]})
DATA ANALYTICS
Expected Goals
pbp = wsba.nhl_scrape_game(2024020918,split_shifts=False,remove=['game-end'])
pbp = wsba.nhl_apply_xG(pbp)
Goal Impacts and Shot Analysis
Stat Aggregation
pbp = wsba.nhl_scrape_season(20232024, local = True)
wsba.nhl_calculate_stats(
pbp,
'skater',
['5v5', '4v4', '3v3'],
season_types=[2, 3],
)
Shot Plotting (Plots, Heatmaps, etc.)
pbp = wsba.nhl_scrape_season(20212022, remove=[], local=True)
plots = wsba.nhl_plot_events(
pbp,
group="game",
entities=[2021020002],
events=["goal", "shot-on-goal", "missed-shot", "blocked-shot"],
strengths=["5v5"],
season_types=2,
legend=True,
rotation=0,
display_range="full",
)
plots[2021020002].savefig("skater_events.png", bbox_inches="tight")
Sample Plot:
REPOSITORY
Team Information
wsba.repo_load_teaminfo()
wsba.repo_load_rosters(seasons=[20212022,20222023,20232024,20242025])
Schedule
wsba.repo_load_schedule(seasons=[20212022,20222023,20232024,20242025])
DOCUMENTATION
View full documentation here: WSBA Hockey Package Documentation
EXPORTING DATA
Tabular scraping functions return Polars DataFrames that can be written directly to CSV or Parquet:
data = wsba.nhl_scrape_edge(20252026, "skater", [8477956])
data.write_csv("edge.csv")
data.write_parquet("edge.parquet")
API fields that contain lists or structs, such as player badges and EDGE detail data, are stored as JSON strings in the returned table so both formats remain portable.
Metadata
Release files for wsba-hockey 1.7.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| wsba_hockey-1.7.3.tar.gz | 2.8 MB | Without provenance | Details for wsba_hockey-1.7.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| wsba_hockey-1.7.3-py3-none-any.whl | Python 3 | none | any | Details for wsba_hockey-1.7.3-py3-none-any.whl |
Total release size: 5.6 MB
Release files / wsba_hockey-1.7.3.tar.gz
| Download URL | wsba_hockey-1.7.3.tar.gz |
|---|---|
| Size | 2.8 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
23572bf98a820af0f101842e82ed038b883ff789d48d6faf439ac86c02cc68d5
|
|
BLAKE2b-256 checksum How to use checksums |
73e844f994f0912af9b3086ec92f4625722a09f03903c9b93a0fa7c743384f8f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / wsba_hockey-1.7.3-py3-none-any.whl
| Download URL | wsba_hockey-1.7.3-py3-none-any.whl |
|---|---|
| Size | 2.8 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b1fdca0309fd7462aa307c451515b21d87d34427e9fe4c82c64de8c4f23a9893
|
|
BLAKE2b-256 checksum How to use checksums |
8375452f85b6053c938f2c36d0f376afd3a5a370228f813c6b4ed35f2026432d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for wsba-hockey 1.7.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.