Skip to main content

chickenstats

Hero image - scatter plot with drumsticks and tooltips

PyPI - Version PyPI - Python Version tests codecov GitHub Release Date - Published_At GitHub License


About

  • Scrape & manipulate data from various NHL endpoints with chickenstats.chicken_nhl, including play-by-play, rosters, and shifts data, including score-adjusted shot metrics
  • Augment play-by-play data & generate custom aggregations from raw csv files downloaded from Evolving-Hockey (subscription required) with chickenstats.evolving_hockey

For more in-depth explanations, tutorials, & detailed reference materials, consult the Documentation.


Compatibility

chickenstats requires Python 3.11.5 or greater & runs on the latest stable versions of Linux, Mac, & Windows operating systems.


Installation

Very simple - install using PyPi. Best practice is to develop in an isolated virtual environment (conda or otherwise), but who's a chicken to judge?

pip install chickenstats

To confirm installation & the latest version (1.9.3):

pip show chickenstats

Optional extras

Core installation includes only the essentials. Install extras for additional output formats or features:

Extra Command What it adds
pandas pip install chickenstats[pandas] Pandas DataFrame output (backend="pandas")
pyarrow pip install chickenstats[pyarrow] PyArrow Table output (backend="pyarrow")
plotting pip install chickenstats[plotting] Matplotlib, Bokeh, Plotly, Seaborn chart helpers
rapm pip install chickenstats[rapm] SciPy sparse matrices for build_rapm_matrix

Usage

chickenstats is structured as two underlying modules, each used with different data sources:

  • chickenstats.chicken_nhl
  • chickenstats.evolving_hockey

The packages and resulting outputs are largely interchangeable, with similar fields across chicken_nhl and evolving_hockey, including high-danger scoring chances, and score- and venue-adjusted fenwick and corsi.

Feel free to use whichever package and data source that you prefer. If you have questions about differences between packages, you can find me on Bluesky at @chickenandstats.com or email me at chicken@chickenandstats.com.

Please note that chickenstats is under active development - features will continue to be added or modified over time.

chicken_nhl

chickenstats.chicken_nhl allows you to scrape play-by-play data and aggregate individual, line, and team statistics. After importing the module, scrape the schedule for game IDs, then play-by-play data for your team of choice:

from chickenstats import Season, Scraper
import polars as pl

season = Season(2025)

schedule = season.schedule("NSH")
game_ids = schedule.filter(pl.col("game_state") == "OFF")["game_id"].to_list()

scraper = Scraper(game_ids)

play_by_play = scraper.play_by_play

You can then aggregate the play-by-play data for individual and on-ice statistics with one line of code:

stats = scraper.stats

It's very easy to introduce additional detail to, as well as change the level of, aggregations, including for season-level statistics accounting for teammates on-ice:

stats = scraper.prep_stats(level="season", teammates=True).stats

There is similar functionality for forward line / defensive pairing stats:

forward_lines = scraper.prep_lines(position="f").lines # Forward lines, defaults to game-level

defense_lines = scraper.prep_lines(position="d", level="season").lines # Defensive pairings, at season level

As well as for team stats:

team_stats = scraper.team_stats

For additional information on usage and functionality, consult the relevant user guide

evolving_hockey

The chickenstats.evolving_hockey module manipulates raw csv files downloaded from Evolving-Hockey. Using their original shifts & play-by-play data, users can add additional information & aggregate for individual & on-ice statistics, including high-danger shooting events, faceoffs, & changes.

First, prep a play-by-play dataframe using raw play-by-play and shifts CSV files from the Evolving-Hockey website:

import polars as pl
from chickenstats.evolving_hockey import prep_pbp, prep_stats, prep_lines

raw_shifts = pl.read_csv('./raw_shifts.csv')
raw_pbp = pl.read_csv('./raw_pbp.csv')

play_by_play = prep_pbp(raw_pbp, raw_shifts)

You can use the play_by_play dataframe in various aggregations. This will return individual game statistics, including on-ice (e.g., GF, CF) & usage (i.e., zone starts), accounting for teammates & opposition on-ice:

individual_game = prep_stats(play_by_play, level='game', teammates=True, opposition=True)

This will return game statistics for forward-line combinations, accounting for opponents on-ice:

forward_lines = prep_lines(play_by_play, level='game', position='f', opposition=True)

For additional information on usage and functionality, consult the relevant user guide


Help

If you need help with any aspect of chickenstats, from installation to usage, please don't hesitate to reach out! You can find me on Bluesky at @chickenandstats.com or email me at chicken@chickenandstats.com.

Please report any bugs or issues via the chickenstats issues page, where you can also post feature requests.


Disclaimer

chickenstats is not affiliated with or endorsed by the NHL or any of its teams; NHL and team names and logos are trademarks of the NHL and its teams and are used only for identification. Data comes from public NHL endpoints, and you are responsible for following the NHL's terms of use.


Contributing

Contributions are welcome! Please read CONTRIBUTING.md for development setup, commit conventions, and the PR process. Found a bug or have a feature request? Open an issue.

This project follows a Code of Conduct. By participating, you are expected to uphold it.


Acknowledgements

chickenstats wouldn't be possible without the support & efforts of countless others. I am obviously extremely grateful, even if there are too many of you to thank individually. However, this chicken will do his best.

First & foremost is my wife - the lovely Mrs. Chicken has been patient, understanding, & supportive throughout the countless hours of development, sometimes to her detriment.

Sincere apologies to the friends & family that have put up with me since my entry into Python, programming, & data analysis in January 2021. Thank you for being excited for me & with me throughout all of this, especially when you've had to fake it...

Thank you to the hockey analytics community on (the artist formerly known as) Twitter. You're producing & reacting to cutting-edge statistical analyses, while providing a supportive, welcoming environment for newcomers. Thank y'all for everything that you do. This is by no means exhaustive, but there are a few people worth calling out specifically:

I'm also grateful to the thriving community of Python educators & open-source contributors on Twitter. Thank y'all for your knowledge & practical advice. Matt Harrison (@mharrison) deserves a special mention for his books on Pandas and XGBoost, both of which are available at his online store. Again, not exhaustive, but others worth thanking individually:

Finally, this library depends on a host of other open-source packages. chickenstats is possible because of the efforts of thousands of individuals, represented below:

Metadata

Release files for chickenstats 1.9.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chickenstats 1.9.3
File Size Uploaded Provenance Actions
chickenstats-1.9.3.tar.gz 255.3 kB With provenance Details for chickenstats-1.9.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for chickenstats 1.9.3
File Interpreter ABI Platform Actions
chickenstats-1.9.3-py3-none-any.whl Python 3 none any Details for chickenstats-1.9.3-py3-none-any.whl

Total release size: 523.4 kB

Release files / chickenstats-1.9.3.tar.gz

Download URL chickenstats-1.9.3.tar.gz
Size 255.3 kB
Tags Source
SHA-256 checksum
How to use checksums
be5c05149077029a3c67abea45fde91716cd4b0ba31e7ff59fcec77c10a1a70e
BLAKE2b-256 checksum
How to use checksums
f278957a36499b12a567619178f776d7f1b280d4392a099b25c708e737399e8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Release files / chickenstats-1.9.3-py3-none-any.whl

Download URL chickenstats-1.9.3-py3-none-any.whl
Size 268.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2285d409bb6efd2499f73e911d0a1b81ec1e1dd7bdde2eff1584551f9c1ffbca
BLAKE2b-256 checksum
How to use checksums
067a334d02ff3205ae1e4a8fa640da6cefe1ecd9fa4a0b4eb18bf11cc92349d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Security for chickenstats 1.9.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for chickenstats-1.9.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

1.9.3 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page