Skip to main content

NOJHL — additional Python functions

Hand-written wrappers, loaders, and helpers in sportsdataverse.hockey.nojhl that are not generated API-endpoint wrappers (those have their own reference pages).

HockeyTech / LeagueStat​

build_family​

build_family(league: 'str') -> 'dict[str, Any]'

Return a dict of public callables for league.

All callables are fully independent closures over the single league string; none share mutable state. The dict is ready to be spread into a module namespace via globals().update(...).

Parameters

ParameterTypeDefaultDescription
leaguestrHockeyTech league code: "ahl", "ohl", "whl", or "qmjhl".

Returns

Keys are the public function names (e.g. "ahl_schedule").

nojhl_game_corsi​

nojhl_game_corsi(game_id: 'int', return_as_pandas: 'bool' = False) -> 'Any'

Player-level on-ice Corsi and Fenwick for a single NOJHL game.

Parameters

ParameterTypeDefaultDescription
game_idintThe HockeyTech game id.
return_as_pandasboolFalseReturn a pandas DataFrame instead of polars.

Returns

One row per player on ice for a shot attempt: player_id (Int64), corsi_for / corsi_against / corsi_for_pct, fenwick_for / fenwick_against / fenwick_for_pct, corsi_includes_missed (Boolean), toi_seconds (Int64) and corsi_for_per60 (Float64, null without time on ice). A pandas DataFrame when return_as_pandas is True.

Raises

ExceptionDescription
NoDataErrorThe feed answered 404.
AssetFetchErrorThe fetch failed: a non-2xx status, an empty or unparseable body, or an Undefined Tab / InvalidView sentinel.

nojhl_game_shifts​

nojhl_game_shifts(game_id: 'int', return_as_pandas: 'bool' = False) -> 'Any'

Parsed shift stints for a single NOJHL game.

Parameters

ParameterTypeDefaultDescription
game_idintThe HockeyTech game id.
return_as_pandasboolFalseReturn a pandas DataFrame instead of polars.

Returns

One row per shift: game_id and player_id (Int64), first_name, last_name, jersey_number, home (Int64, 1 = home), period, start_time / end_time / length (clock strings), start_s / end_s (Int64 seconds) and the goal_on_shift / penalty_on_shift flags. A pandas DataFrame when return_as_pandas is True.

Raises

ExceptionDescription
NoDataErrorThe feed answered 404.
AssetFetchErrorThe fetch failed: a non-2xx status, an empty or unparseable body, or an Undefined Tab / InvalidView sentinel.

nojhl_game_summary​

nojhl_game_summary(game_id: 'int') -> 'dict'

NOJHL game summary — dict of frames (game/goals/penalties/shots_by_period/three_stars).

Parameters

ParameterTypeDefaultDescription
game_idintThe HockeyTech game id.

Returns

game (one row: game_id, date, status, venue, attendance, both teams and scores), goals (one row per goal with the scorer, both assists and the plus / minus skaters), penalties (one row per penalty), shots_by_period (side, period, shots) and three_stars. When the league denies the summary view, the event frames are empty and game is a game_id stub row.

Raises

ExceptionDescription
NoDataErrorThe feed answered 404.
AssetFetchErrorThe fetch failed: a non-2xx status, an empty or unparseable body, or an Undefined Tab / InvalidView sentinel.

nojhl_leaders​

nojhl_leaders(season: 'Optional[int]' = None, season_id: 'Optional[int]' = None, return_as_pandas: 'bool' = False) -> 'Any'

NOJHL statistical leaders for a given season.

Parameters

ParameterTypeDefaultDescription
seasonOptional[int]NoneSeason as an END year (2026 = the 2025-26 season). Defaults to the newest regular season when neither season nor season_id is given.
season_idOptional[int]NoneThe HockeyTech season id, when it is already known.
return_as_pandasboolFalseReturn a pandas DataFrame instead of polars.

Returns

One row per ranked skater (points and goals leaders): rank (Int64), player_id, name, jersey_number, position, team_id / team_name / team_code, stat_formatted and type_formatted (player_id / team_id Int64, the rest String), plus photo and logo URLs. A pandas DataFrame when return_as_pandas is True.

col_nametypedescription
rankInt64Rank of the streak.
player_idInt64Unique player identifier.
jersey_numberStringJersey number.
nameStringTeam mascot name.
team_idInt64Unique team identifier.
team_nameStringTeam name.
team_codeStringTeam abbreviation.
team_logoStringURL to the team logo image.
team_logo_smallStringURL of the logo of the leader's team; the host and path vary by league and team (an lscluster.hockeytech.com download.php link or an assets.leaguestat.com logos path), and it can be the same URL as team_logo.
stat_formattedStringThe leader's value in the type_formatted category as a display string; for the Points and Goals leaderboards requested here it is a whole-number count (e.g. '29'), and '0' on every row when the season has no games yet.
type_formattedStringLeaderboard the row belongs to, 'Points' or 'Goals': the function requests those two skater stat types and stacks both leaderboards into one frame.
photoStringURL to the player photo.
photo_smallStringURL of the player's 60x60 headshot on assets.leaguestat.com, keyed by league and player_id (e.g. 'https://assets.leaguestat.com//60x60/<player_id>.jpg'), or the generic placeholder 'https://lscluster.hockeytech.com/img/nophoto.png'.
positionStringPlayer position.
divisionStringDivision identifier.

Raises

ExceptionDescription
NoDataErrorThe feed answered 404.
AssetFetchErrorThe fetch failed: a non-2xx status, an empty or unparseable body, or an Undefined Tab / InvalidView sentinel.

nojhl_pbp​

nojhl_pbp(game_id: 'int', return_as_pandas: 'bool' = False) -> 'Any'

NOJHL play-by-play — one row per event, fully enriched.

Parameters

ParameterTypeDefaultDescription
game_idintThe HockeyTech game id.
return_as_pandasboolFalseReturn a pandas DataFrame instead of polars.

Returns

One row per event (shot, goal, penalty, faceoff, hit, goalie change ...): game_id, event, team_id, period_of_game, time_of_period, rink x_coord / y_coord (Float64, feet, centre ice at (0, 0); the raw 600×300 feed canvas values are x_coord_original / y_coord_original), the feet frames x_coord_fixed / y_coord_fixed (home team shoots right) and x_coord_right / y_coord_right (every team shoots right), the primary / second / third player and goalie ids (Int64) and names, the plus / minus skaters on a goal, game metadata from the game summary, and derived shot_distance / shot_angle / scoring_chance and the on_ice_home / on_ice_away skaters from the shift feed. Some leagues (USHL, MJHL) publish only goals, penalties and goalie changes, with no coordinates. A pandas DataFrame when return_as_pandas is True.

Raises

ExceptionDescription
NoDataErrorThe feed answered 404.
AssetFetchErrorThe fetch failed: a non-2xx status, an empty or unparseable body, or an Undefined Tab / InvalidView sentinel.

nojhl_player_stats​

nojhl_player_stats(player_id: 'int', return_as_pandas: 'bool' = False) -> 'Any'

NOJHL player season stats across all seasons.

Parameters

ParameterTypeDefaultDescription
player_idintThe HockeyTech player id.
return_as_pandasboolFalseReturn a pandas DataFrame instead of polars.

Returns

One row per season (and team) the player played: season_id, season_name, playoff, team_id / team_name / team_code, games_played, goals, assists, points, plus_minus, penalty_minutes, power-play / short-handed / shootout splits, shots, faceoff_wins / faceoff_attempts, ice_time and stat_type. season_id and team_id are Int64; the rest are String, as the feed ships them. A pandas DataFrame when return_as_pandas is True.

Raises

ExceptionDescription
NoDataErrorThe feed answered 404.
AssetFetchErrorThe fetch failed: a non-2xx status, an empty or unparseable body, or an Undefined Tab / InvalidView sentinel.

nojhl_player_toi​

nojhl_player_toi(game_id: 'int', return_as_pandas: 'bool' = False) -> 'Any'

Per-player time-on-ice totals for a single NOJHL game.

Parameters

ParameterTypeDefaultDescription
game_idintThe HockeyTech game id.
return_as_pandasboolFalseReturn a pandas DataFrame instead of polars.

Returns

One row per player: player_id (Int64), first_name, last_name, toi_seconds (Int64), num_shifts and avg_shift_s (Float64). A pandas DataFrame when return_as_pandas is True.

Raises

ExceptionDescription
NoDataErrorThe feed answered 404.
AssetFetchErrorThe fetch failed: a non-2xx status, an empty or unparseable body, or an Undefined Tab / InvalidView sentinel.

nojhl_schedule​

nojhl_schedule(season: 'Optional[int]' = None, season_id: 'Optional[int]' = None, return_as_pandas: 'bool' = False) -> 'Any'

NOJHL schedule — one row per game of one season.

Parameters

ParameterTypeDefaultDescription
seasonOptional[int]NoneSeason as an END year (2026 = the 2025-26 season). Defaults to the newest regular season when neither season nor season_id is given.
season_idOptional[int]NoneThe HockeyTech season id, when it is already known.
return_as_pandasboolFalseReturn a pandas DataFrame instead of polars.

Returns

One row per game: game_id, game_date, game_status, home_team / home_team_id / home_score, away_team / away_team_id / away_score, venue, season_id and game_type; the *_id columns are Int64, the rest String. Only the requested season's games: a regular season, its playoffs and its preseason are separate season ids, so pass season_id (from nojhl_season_id()) for the playoffs. A pandas DataFrame when return_as_pandas is True.

col_nametypedescription
game_idInt64Unique game identifier.
game_dateStringGame date.
game_statusStringGame status text.
home_teamStringHome team name.
home_team_idInt64Home team identifier.
home_scoreStringHome team final score.
away_teamStringAway team name.
away_team_idInt64Away team identifier.
away_scoreStringAway team final score.
venueStringVenue where the game was played.
season_idInt64Season identifier.
game_typeStringGame type the row belongs to.

Raises

ExceptionDescription
NoDataErrorThe feed answered 404. With no season given, the seasons feed lists no regular season.
AssetFetchErrorThe fetch failed: a non-2xx status, an empty or unparseable body, or an Undefined Tab / InvalidView sentinel.
ValueErrorNo season matches season.

nojhl_standings​

nojhl_standings(season: 'Optional[int]' = None, season_id: 'Optional[int]' = None, return_as_pandas: 'bool' = False) -> 'Any'

NOJHL standings — one row per team.

Parameters

ParameterTypeDefaultDescription
seasonOptional[int]NoneSeason as an END year (2026 = the 2025-26 season). Defaults to the newest regular season when neither season nor season_id is given.
season_idOptional[int]NoneThe HockeyTech season id, when it is already known.
return_as_pandasboolFalseReturn a pandas DataFrame instead of polars.

Returns

One row per team: team, team_code, team_rank and wins (Int64), and games_played, losses, regulation_wins, non_reg_wins, non_reg_losses, points, goals_for, goals_against, games_remaining, percentage and overall_rank (String, as the feed ships them). A pandas DataFrame when return_as_pandas is True.

col_nametypedescription
winsStringWins.
lossesStringLosses.
ot_lossesStringOvertime losses.
shootout_lossesStringShootout losses.
rowString
pointsInt64Total points (goals + assists).
penalty_minutesStringPenalty minutes.
streakStringCurrent streak value.
goals_forStringGoals for.
goals_againstStringGoals against.
percentageStringPoints percentage (feed header 'Percentage'): points earned divided by the maximum points available from games played, as a three-decimal string, e.g. '0.833' for 5 of 6 possible points; '0.000' before a team has played.
games_playedStringGames played.
team_rankInt64Team rank in the standings.
past_10StringRecord over the team's most recent 10 games (feed header 'Past 10 Games') as a hyphenated string: W-L-OTL-SOL when four parts are shipped (e.g. '2-0-0-1'), W-L-OTL when three are (e.g. '0-2-1').
teamStringTeam name.
team_codeStringTeam abbreviation.

Raises

ExceptionDescription
NoDataErrorThe feed answered 404.
AssetFetchErrorThe fetch failed: a non-2xx status, an empty or unparseable body, or an Undefined Tab / InvalidView sentinel.

nojhl_team_roster​

nojhl_team_roster(team_id: 'int', season: 'Optional[int]' = None, season_id: 'Optional[int]' = None, return_as_pandas: 'bool' = False) -> 'Any'

NOJHL team roster for a given team + season.

Parameters

ParameterTypeDefaultDescription
team_idintThe HockeyTech team id.
seasonOptional[int]NoneSeason as an END year (2026 = the 2025-26 season). Defaults to the newest regular season when neither season nor season_id is given.
season_idOptional[int]NoneThe HockeyTech season id, when it is already known.
return_as_pandasboolFalseReturn a pandas DataFrame instead of polars.

Returns

One row per rostered player: player_id, person_id, names (first_name, last_name, display_name), position, tp_jersey_number, shoots / catches, height / weight, birthdate, home and birth places, rookie, veteran_status, draft_status and player_image. The id / *_id columns are Int64; the rest are String, as the feed ships them. A pandas DataFrame when return_as_pandas is True.

Raises

ExceptionDescription
NoDataErrorThe feed answered 404.
AssetFetchErrorThe fetch failed: a non-2xx status, an empty or unparseable body, or an Undefined Tab / InvalidView sentinel.

nojhl_teams​

nojhl_teams(season: 'Optional[int]' = None, season_id: 'Optional[int]' = None, return_as_pandas: 'bool' = False) -> 'Any'

NOJHL teams for a given season.

Parameters

ParameterTypeDefaultDescription
seasonOptional[int]NoneSeason as an END year (2026 = the 2025-26 season). Defaults to the newest regular season when neither season nor season_id is given.
season_idOptional[int]NoneThe HockeyTech season id, when it is already known.
return_as_pandasboolFalseReturn a pandas DataFrame instead of polars.

Returns

One row per team: team_id, team_name, team_code, team_nickname, team_label, division and team_logo; team_id is Int64, the rest String. A pandas DataFrame when return_as_pandas is True.

col_nametypedescription
team_nameStringTeam name.
team_idInt64Unique team identifier.
team_codeStringTeam abbreviation.
team_nicknameStringTeam nickname.
team_labelStringShort city label.
divisionStringDivision identifier.
team_logoStringURL to the team logo image.

Raises

ExceptionDescription
NoDataErrorThe feed answered 404.
AssetFetchErrorThe fetch failed: a non-2xx status, an empty or unparseable body, or an Undefined Tab / InvalidView sentinel.

Dates and seasons​

most_recent_nojhl_season​

most_recent_nojhl_season() -> 'int'

Newest NOJHL regular season as an end-year integer: the highest season_yr of a regular season that is not a one-off event, so a preseason listed first is not a default.

Returns

The newest regular season's END year (2026 = the 2025-26 season).

Raises

ExceptionDescription
NoDataErrorThe seasons feed lists no regular season.
AssetFetchErrorThe seasons feed failed.

nojhl_season_id​

nojhl_season_id(return_as_pandas: 'bool' = False) -> 'Any'

All NOJHL seasons with end-year + game-type labels.

Parameters

ParameterTypeDefaultDescription
return_as_pandasboolFalseReturn a pandas DataFrame instead of polars.

Returns

One row per season: season_id (Int64), season_name, season_short, career, playoff, start_date, end_date, season_yr (Int64, the END year) and game_type_label. A pandas DataFrame when return_as_pandas is True.

col_nametypedescription
season_idInt64Season identifier.
season_nameStringFull season name (e.g., "2024-25 Regular Season").
season_shortStringShort season name.
careerStringWhether this is a career-stats season.
playoffStringWhether the row is playoff statistics.
start_dateStringSeason start date.
end_dateStringSeason end date.
season_yrInt64End year of the season the row belongs to, read from its name: "2025-26", "2025/26" and "2025-2026" are 2026, "26-27" is 2027, a compact "2425" is 2025. A preseason or exhibition named with the one year it starts in belongs to the next season ("2026 Pre-season" is 2027). Null when the name holds no year.
game_type_labelStringGame type read from the season name, first match wins: "preseason" (pre-season, preseason), "playoffs" (playoff, post), "exhibition", else "regular". One-off events such as all-star games are labelled "regular" too; season resolution skips them.

Raises

ExceptionDescription
NoDataErrorThe feed answered 404.
AssetFetchErrorThe fetch failed: a non-2xx status, an empty or unparseable body, or an Undefined Tab / InvalidView sentinel.