Skip to main content

resolve

resolve(
values: Any,
league: str,
season: Any = None,
id_system: str = 'auto',
strict: bool = False,
) -> Any

Canonical team_id(s) for team values in one league.

Accepts ids and names from any supported source (ESPN, nflverse, MLB Stats, nba_api, HockeyTech, CFBD, sdvplotR) and returns the bundled index's canonical team_id, in the same container the values came in. Values that do not resolve come back as None with one SdvplotWarning, or raise with strict=True.

Arguments​

NameTypeDescription
valuesAnyA scalar, list/tuple, numpy array, or pandas/polars Series of team identifiers in any supported id system. NHL stats API ids overlap ESPN's, so "auto" never reads a number as one: pass id_system="nhl_id" for them (NHL tri-codes such as "NJD" resolve under "auto").
leaguestrThe SDV league key, e.g. "nfl", "cfb", "ohl". Required: the same abbreviation means different teams in different leagues.
seasonAnyOne season for all values, or one per value. Picks the right team for a reused code; without one, a reused code means its current holder (KCA: the Royals, not the 1955-67 Kansas City Athletics).
id_systemstr"auto" (try the priority order) or one system name.
strictboolRaise UnresolvedTeamError instead of warning when a value does not resolve.

Returns​

str | list | Series | None: The same shape as values: a team_id string (or None), a list, or a Series of the caller's library.

Raises​

  • TypeError: If values is not a scalar, list, tuple, numpy array, or pandas/polars Series.
  • ValueError: If league or id_system is unknown, or season is not a year (or a list whose length does not match the teams).
  • UnresolvedTeamError: If strict=True and a value does not resolve.

Example​

import sdvplot

sdvplot.resolve("LV", "nfl") # '13'
sdvplot.resolve(["KC", "SF"], "nfl") # ['12', '25']

See also​