evolving_hockey
Usage information about the evolving_hockey
module.
For in-depth materials, please consult the Reference
Basic usage
Import module
The evolving_hockey
module and relevant functions can be imported using the below snippet:
Play-by-play data
All functions will need a cleaned play-by-play dataframe in order to aggregate the statistics:
shifts_raw = pd.read_csv('shifts_raw.csv') # (1)!
pbp_raw = pd.read_csv('pbp_raw.csv') # (2)!
pbp = prep_pbp(pbp_raw, shifts_raw)
- Get a Pandas DataFrame of shifts data from Evolving-Hockey.com
- Ditto for play-by-play data from Evolving-Hockey.com
Individual stats
You can use the cleaned play-by-play data to see individual stats, grouped at various levels. This example aggregates skaters' individual and on-ice statistics to the game level, grouped by teammates and opposition:
This example groups individual and on-ice stats to the session level, grouping by score state:
Basic game-level statistics can be viewed with the default keyword arguments:
Line stats
You can also aggregate the data for forward or defensive (or both) line stats. This first example aggregates line stats to the game level, grouped by opposition:
Similarly to the prep_stats
function, you can group by teammates and score state:
Team stats
Aggregate team statistics in the same way as prep_stats
and prep_lines
functions. This examples aggregates team stats
to game level:
You can also group by score state: