Skip to main content

SPHL — additional Python functions

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

Utilities & helpers​

most_recent_sphl_season​

most_recent_sphl_season() -> 'int'

Most-recent SPHL season as an end-year integer (max season_yr), or 2026.

Other​

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").

sphl_game_corsi​

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

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

Parameters

ParameterTypeDefaultDescription
game_idint
return_as_pandasboolFalse

sphl_game_shifts​

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

Parsed shift stints for a single SPHL game.

Parameters

ParameterTypeDefaultDescription
game_idint
return_as_pandasboolFalse

sphl_game_summary​

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

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

Parameters

ParameterTypeDefaultDescription
game_idint

sphl_leaders​

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

SPHL statistical leaders for a given season.

Parameters

ParameterTypeDefaultDescription
seasonOptional[int]None
season_idOptional[int]None
return_as_pandasboolFalse

sphl_pbp​

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

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

Parameters

ParameterTypeDefaultDescription
game_idint
return_as_pandasboolFalse

sphl_player_stats​

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

SPHL player season stats across all seasons.

Parameters

ParameterTypeDefaultDescription
player_idint
return_as_pandasboolFalse

sphl_player_toi​

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

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

Parameters

ParameterTypeDefaultDescription
game_idint
return_as_pandasboolFalse

sphl_schedule​

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

SPHL schedule — one row per game.

Parameters

ParameterTypeDefaultDescription
seasonOptional[int]None
season_idOptional[int]None
return_as_pandasboolFalse

Returns

col_nametypedescription
game_idcharacterUnique game identifier.
game_datecharacterGame date (YYYY-MM-DD).
game_statuscharacterGame status label.
home_teamcharacterHome team name.
home_team_idcharacterUnique identifier for the home team.
home_scorecharacterHome team score at the time of the play.
away_teamcharacterAway team name.
away_team_idcharacterUnique identifier for the away team.
away_scorecharacterAway team score at the time of the play.
venuecharacterVenue name.
season_idcharacterUnique season identifier.
game_typecharacterThe most recent game type of that season that a player appeared on the roster.

sphl_season_id​

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

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

Parameters

ParameterTypeDefaultDescription
return_as_pandasboolFalse

Returns

col_nametypedescription
season_idintegerUnique season identifier.
season_namecharacterFull season name (e.g., "2024-25 Regular Season").
season_shortcharacterShort season name.
careercharacterWhether this is a career-stats season.
playoffcharacterWhether the row is playoff statistics.
start_datecharacterStart date (YYYY-MM-DD).
end_datecharacterEnd date (YYYY-MM-DD).
season_yrintegerYear derived from the season name (concluding year).
game_type_labelcharacterGame type: "preseason", "regular", or "playoffs".

sphl_standings​

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

SPHL standings — one row per team.

Parameters

ParameterTypeDefaultDescription
seasonOptional[int]None
season_idOptional[int]None
return_as_pandasboolFalse

Returns

col_nametypedescription
team_codecharacterInternal team code.
winscharacterTotal wins.
lossescharacterTotal losses.
ot_lossescharacterOvertime losses.
shootout_lossescharacterShootout losses.
pointsintegerPoints scored.
penalty_minutescharacterPenalty minutes.
streakcharacterCurrent streak (e.g. 'W3' for three-game win streak).
goals_forcharacterGoals for.
goals_againstcharacterGoals against.
percentagecharacterPoints 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_playedcharacterGames played.
team_rankintegerTeam rank in the standings.
past_10characterRecord 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').
teamcharacterTeam-side label or team identifier.

sphl_team_roster​

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

SPHL team roster for a given team + season.

Parameters

ParameterTypeDefaultDescription
team_idint
seasonOptional[int]None
season_idOptional[int]None
return_as_pandasboolFalse

sphl_teams​

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

SPHL teams for a given season.

Parameters

ParameterTypeDefaultDescription
seasonOptional[int]None
season_idOptional[int]None
return_as_pandasboolFalse

Returns

col_nametypedescription
team_namecharacterFull team display name (e.g. 'Las Vegas Aces').
team_idcharacterUnique team identifier.
team_codecharacterInternal team code.
team_nicknamecharacterTeam nickname.
team_labelcharacterShort city label.
divisioncharacterTeam division.
team_logocharacterTeam logo image URL.