Skip to main content

MCH — additional Python functions

Hand-written wrappers, loaders, and helpers in sportsdataverse.mch not covered by the generated API-endpoint reference above.

Models and calculators​

mch_ratings​

mch_ratings(dates: 'list[str]', *, return_as_pandas: 'bool' = False) -> 'pl.DataFrame | pd.DataFrame'

MCH opponent-adjusted goal-margin ratings over a set of scoreboard dates.

Fetches espn_mch_scoreboard for each date in dates, concatenates the completed games, and adjusts with sportsdataverse.hockey.college_hockey_ratings.college_hockey_ratings.

Parameters

ParameterTypeDefaultDescription
dateslist[str]YYYYMMDD date strings to fetch (ESPN has no single "whole season" scoreboard endpoint; the caller supplies the date sweep -- see dev/league_ports/capture_wch_and_scoreboards.py for the sweep used to build the committed oracle fixture).
return_as_pandasboolFalseReturn pandas instead of polars.

Returns

One row per team: team_id, adj_off, adj_def, adj_net, raw_off, raw_def, games.

col_nametypedescription
team_idcharacter
adj_offdouble
adj_defdouble
adj_netdouble
raw_offdouble
raw_defdouble
gamesinteger

Example

from sportsdataverse.hockey.mch import mch_ratings
ratings = mch_ratings(["20250118", "20250201"])
ratings.sort("adj_net", descending=True).head()