College football — additional Python functions — IDs and crosswalks
cfb_odds_events_crosswalk
cfb_odds_events_crosswalk(season: 'Optional[int]' = None, week: 'Optional[int]' = None, *, sport: 'str' = 'americanfootball_ncaaf', api_key: 'Optional[str]' = None, season_type: 'int' = 2, return_as_pandas: 'bool' = False, **kwargs: 'Any') -> 'DataFrameT'
Match The Odds API CFB events to ESPN game ids.
Pulls the upcoming/live events for sport from The Odds API and the ESPN
scoreboard for (season, week), then joins them on the order-independent
team matchup so each odds event id maps to its ESPN event id. Because
The Odds API only lists near-term events, this is most useful for the
current/upcoming week.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
season | Optional[int] | None | ESPN season year for the schedule side. Defaults to the most recent CFB season. |
week | Optional[int] | None | ESPN schedule week. When None, ESPN returns its default (current) slate. |
sport | str | 'americanfootball_ncaaf' | The Odds API sport key. Defaults to "americanfootball_ncaaf". |
api_key | Optional[str] | None | The Odds API key; falls back to the ODDS_API_KEY env var. |
season_type | int | 2 | ESPN season type (2 regular, 3 post-season). Defaults to 2. |
return_as_pandas | bool | False | If True return a pandas DataFrame; otherwise polars. |
Returns
A polars DataFrame (pandas when return_as_pandas=True), one row per odds event, with columns matchup_key, odds_event_id, espn_game_id, home_team, away_team, commence_time, espn_date, matched_sources.
| col_name | type | description |
|---|---|---|
matchup_key | String | Order-independent key for the game: the two normalized team names sorted alphabetically and joined with a pipe (e.g. 'akron zips|minnesota golden gophers'). Built from the Odds API home_team and away_team names. |
odds_event_id | String | The Odds API event id, a 32-character lowercase hex string (e.g. 'f06e90b4212fb514f3564ded9f190107'); the id column of toa_sports_events. |
espn_game_id | Int64 | |
home_team | String | Home team name. |
away_team | String | Away team name. |
commence_time | String | Scheduled kickoff of the Odds API event, an ISO-8601 UTC string with a trailing Z (e.g. '2026-09-19T16:00:00Z'), kept as text. |
espn_date | String | Kickoff date as YYYY-MM-DD: the first ten characters of the matched ESPN game's UTC start timestamp; null when no ESPN game matched. |
matched_sources | String | 'odds+espn' when the Odds API event matched an ESPN game on matchup_key, 'odds' when it did not; all 88 sampled rows were 'odds+espn'. |
Raises
| Exception | Description |
|---|---|
NoDataError | The Odds API answered 404 (e.g. an unknown sport). |
AssetFetchError | The Odds API answered any other non-2xx status (a rejected key, spent quota, a 5xx that outlived the retries) or a non-JSON body. Its error body used to be parsed as an event list. |
Example
from sportsdataverse.cfb import cfb_odds_events_crosswalk
xwalk = cfb_odds_events_crosswalk(season=2024, week=5)
matched = xwalk.filter(pl.col("espn_game_id").is_not_null())
cfb_rosters_crosswalk
cfb_rosters_crosswalk(espn_team_id: 'Union[int, str]', fox_team_id: 'Union[int, str]', *, season: 'Optional[int]' = None, providers: 'Optional[Sequence[str]]' = None, yahoo_team_id: 'Optional[str]' = None, return_as_pandas: 'bool' = False, **kwargs: 'Any') -> 'DataFrameT'
Build the ESPN x Fox x Yahoo player-id crosswalk for one team.
Fetches the selected providers' players for the team, matches them on
normalized name (with jersey as a confidence signal), and returns each
player's ESPN, Fox, and Yahoo athlete ids side by side. Use
cfb_teams_crosswalk first to translate an ESPN team id into the
matching Fox team id.
The default is ("espn", "fox"). Yahoo is opt-in (pass
providers=("espn", "fox", "yahoo")): its leg is Yahoo's current roster
(sportsdataverse.providers.yahoo.yahoo_team_roster, active players only), and
each Yahoo player attaches to the ESPN/Fox player with the same name and
jersey, else the same name when that name is unique on the team. Pass
yahoo_team_id (yahoo_team_id of cfb_teams_crosswalk) to skip
the lookup of the Yahoo team in Yahoo's team directory; when no Yahoo team
matches, the Yahoo columns are null and a warning is logged.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
espn_team_id | Union[int, str] | ESPN team id (e.g. 194 for Ohio State). | |
fox_team_id | Union[int, str] | Fox Bifrost team id (e.g. 25 for Ohio State). | |
season | Optional[int] | None | Season of Yahoo's team directory, used to find the Yahoo team when yahoo_team_id is not given. Defaults to the most recent CFB season. All three roster feeds return the current roster whatever the season. |
providers | Optional[Sequence[str]] | None | Which sources to include — any of "espn", "fox", "yahoo". None (default) uses ("espn", "fox"); add "yahoo" explicitly for its leg, or pass a single source. |
yahoo_team_id | Optional[str] | None | Yahoo dotted team id (e.g. "ncaaf.t.33" for Ohio State). Optional; looked up by team name when None. Unused when Yahoo isn't selected. |
return_as_pandas | bool | False | If True return a pandas DataFrame; otherwise polars. |
Returns
A polars DataFrame (pandas when return_as_pandas=True) with columns person_key, espn_athlete_id, fox_athlete_id, yahoo_athlete_id, name, espn_jersey, fox_jersey, espn_position, fox_position, yahoo_position, match_method, matched_sources. match_method reflects the ESPN/Fox jersey agreement: name_jersey (agree), name (name only), name_jersey_conflict (jerseys differ — review), or unmatched.
| col_name | type | description |
|---|---|---|
person_key | String | |
espn_athlete_id | Int64 | |
fox_athlete_id | String | |
yahoo_athlete_id | String | |
name | String | Position name (e.g. Quarterback). |
espn_jersey | String | |
fox_jersey | String | |
espn_position | String | |
fox_position | String | |
yahoo_position | String | |
match_method | String | Combination of matched sources, e.g. "fox+bart" / "fox_only" / "bart_only" / "espn_only". |
matched_sources | String |
Example
from sportsdataverse.cfb import cfb_rosters_crosswalk
xwalk = cfb_rosters_crosswalk(espn_team_id=194, fox_team_id=25)
matched = xwalk.filter(pl.col("matched_sources") == "espn+fox")
# Add Yahoo's ids, with the Yahoo team id from the teams crosswalk
three = cfb_rosters_crosswalk(194, 25, providers=("espn", "fox", "yahoo"), yahoo_team_id="ncaaf.t.33")
cfb_schedule_crosswalk
cfb_schedule_crosswalk(season: 'int', week: 'Optional[int]' = None, *, season_type: 'int' = 2, providers: 'Optional[Sequence[str]]' = None, return_as_pandas: 'bool' = False, **kwargs: 'Any') -> 'DataFrameT'
Build the ESPN x Fox x Yahoo CFB game-id crosswalk.
Each ESPN game is keyed by its order-independent team matchup, and the Fox
and Yahoo games are mapped onto it, so each row pairs the ESPN event id
with the Fox Bifrost event id and the Yahoo dotted game id. Where a provider
has no game, its columns are None and matched_sources records who
contributed — so regular season, conference championships, bowls, and the
CFP all flow through the same call, degrading gracefully when a source lacks
a game.
Two modes:
- Full season (
weekomitted): pulls every ESPN game (regular weeks + bowls + CFP), Fox's full season, and Yahoo's full season, and matches on team + date (date disambiguates rematches — a regular-season game vs a conference-championship or CFP rematch of the same teams). - Single week (
weekgiven): just that week's slate, matched on team.
A provider with no game for a matchup (Fox's offseason-projected CFP games, a 404 week) leaves that provider's columns null. A fetch that FAILED raises, so the same upstream data always builds the same rows.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
season | int | Season year (e.g. 2024). | |
week | Optional[int] | None | Schedule week number for single-week mode; omit (None) for the whole season. |
season_type | int | 2 | ESPN season type for single-week mode — 2 regular, 3 post-season (week=1 bowls, week=999 CFP). Ignored in full-season mode. Defaults to 2. |
providers | Optional[Sequence[str]] | None | Which sources to include — any of "espn", "fox", "yahoo". None (default) uses all three; pass a subset for a pairwise crosswalk (e.g. ("espn", "fox")) or a single source. Unselected providers are not fetched and surface as null columns. |
return_as_pandas | bool | False | If True return a pandas DataFrame; otherwise polars. |
Returns
A polars DataFrame (pandas when return_as_pandas=True) with columns matchup_key, espn_game_id, fox_game_id, yahoo_game_id, yahoo_global_game_id, home_team, away_team, espn_date, fox_date, yahoo_date, matched_sources. yahoo_global_game_id is always null: it came from Yahoo's editorial scoreboard, retired 2026-11-20, and shangrila has no counterpart.
| col_name | type | description |
|---|---|---|
matchup_key | String | |
espn_game_id | Int64 | |
fox_game_id | String | |
yahoo_game_id | String | |
yahoo_global_game_id | String | |
home_team | String | Home team name. |
away_team | String | Away team name. |
espn_date | String | |
fox_date | String | |
yahoo_date | String | |
matched_sources | String |
Raises
| Exception | Description |
|---|---|
CrosswalkSourceError | Full-season mode, a provider fetch failed after its retries (a 404 is "no games", never a failure), or every Yahoo week came back empty or 404. |
Example
from sportsdataverse.cfb import cfb_schedule_crosswalk
full = cfb_schedule_crosswalk(2024)
all_three = full.filter(pl.col("matched_sources") == "espn+fox+yahoo")
# Or just one week
wk5 = cfb_schedule_crosswalk(2024, 5)
cfb_teams_crosswalk
cfb_teams_crosswalk(*, season: 'Optional[int]' = None, week: 'int' = 1, providers: 'Optional[Sequence[str]]' = None, return_as_pandas: 'bool' = False, **kwargs: 'Any') -> 'DataFrameT'
Build the ESPN x Fox x Yahoo CFB team-id crosswalk.
Fetches the selected provider team directories, normalizes each team name to
a shared key, and full-outer-joins them so every row carries each provider's
id, name, and abbreviation (None where a provider has no match). The
matched_sources column records which providers contributed.
Yahoo's directory covers every division it carries (FBS, FCS, D2, D3, NAIA,
USCAA), and all of them are kept. Most lower-division teams have no ESPN
match, so their espn_* columns are null. To keep FBS/FCS teams, join
yahoo_cfb_teams() (team_id to yahoo_team_id) and filter
division to "FBS"/"FCS"; filter on espn_team_id only to keep
ESPN-matched teams.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
season | Optional[int] | None | Season year sent to Yahoo's leagueTeams directory, which answers with the current directory for any season. Defaults to the most recent CFB season. |
week | int | 1 | Ignored; kept so existing calls still work. Defaults to 1. |
providers | Optional[Sequence[str]] | None | Which sources to include — any of "espn", "fox", "yahoo". None (default) uses all three; pass a subset for a pairwise crosswalk (e.g. ("espn", "fox")) or a single source. Unselected providers are not fetched and surface as null columns. |
return_as_pandas | bool | False | If True return a pandas DataFrame; otherwise polars. |
Returns
A polars DataFrame (pandas when return_as_pandas=True) with columns norm_key, espn_team_id, espn_team, espn_abbreviation, fox_team_id, fox_team, fox_abbreviation, yahoo_team_id, yahoo_team, yahoo_abbreviation, matched_sources.
| col_name | type | description |
|---|---|---|
norm_key | String | Shared join key across providers: the team name lowercased, ASCII-folded, stripped of punctuation, whitespace-collapsed and alias-mapped (e.g. 'alabama a m bulldogs'). |
espn_team_id | Int64 | |
espn_team | String | ESPN's full team display name, school plus mascot (e.g. 'Akron Zips'); null on rows that matched no ESPN team. |
espn_abbreviation | String | |
fox_team_id | String | |
fox_team | String | Fox Sports' team name, which that feed ships in all capitals (e.g. 'AIR FORCE FALCONS'); null when no Fox team matched. |
fox_abbreviation | String | Fox Sports' short team code from its teamnav directory (e.g. 'AC', 'AKRON'), which can differ from the Yahoo code for the same school ('AKRON' vs 'AKR'); null when no Fox team matched. |
yahoo_team_id | String | |
yahoo_team | String | Yahoo Sports' team display name, school plus mascot (e.g. 'Akron Zips'); null when no Yahoo team matched. |
yahoo_abbreviation | String | Yahoo Sports' short team code (e.g. 'ACU', 'AKR'); null when no Yahoo team matched. |
matched_sources | String | Plus-joined provenance tag naming which of espn, fox and yahoo contributed a directory row for this team, e.g. 'espn+fox+yahoo', 'espn', 'fox+yahoo'. |
Example
from sportsdataverse.cfb import cfb_teams_crosswalk
xwalk = cfb_teams_crosswalk(season=2024)
row = xwalk.filter(pl.col("espn_team_id") == 194) # Ohio State
# Pairwise — just ESPN vs Fox
espn_fox = cfb_teams_crosswalk(providers=("espn", "fox"))