πβΎπ Newer ESPN leagues with sportsdataverse-py
Spring pro football is back, college diamonds are packed, and NCAA rinks are full. π
In a few lines of Python you're about to pull live scoreboards, schedules,
standings, team rosters, and play-by-play for seven leagues
added to sportsdataverse-py in the 0.0.59 ESPN expansion:
| Sport | Leagues |
|---|---|
| Spring / pro football | United Football League (UFL), XFL, Canadian Football League (CFL) |
| College baseball / softball | NCAA Baseball (college_baseball), NCAA Softball (college_softball) |
| NCAA hockey | Men's College Hockey (mch), Women's College Hockey (wch) |
Every league rides the same cross-league ESPN wrapper surface introduced in
0.0.51 β a single parameterized core (sportsdataverse._common_espn) with
thin per-league extension modules. That means identical function naming across
all leagues: espn_{prefix}_scoreboard, espn_{prefix}_team_schedule,
espn_{prefix}_standings, espn_{prefix}_team_roster, espn_{prefix}_summary,
and 80+ more short names per league.
Namespace noteβ
The canonical import paths are nested under the sport group:
from sportsdataverse.football.ufl import espn_ufl_scoreboard
from sportsdataverse.baseball.college_baseball import espn_college_baseball_teams_site
from sportsdataverse.hockey.mch import espn_mch_scoreboard
Top-level shortcuts (e.g. sportsdataverse.ufl) exist for back-compat but emit a
DeprecationWarning β prefer the nested paths shown throughout this notebook.
π§° The toolboxβ
Every wrapper returns a raw dict by default (return_parsed=False). Pass
return_parsed=True to get a tidy polars DataFrame where a parser is
registered, or return_as_pandas=True for a pandas DataFrame. The
function surface is identical across all seven leagues below.
| Function pattern | What it gives you |
|---|---|
espn_{prefix}_scoreboard(dates=YYYYMMDD) | Live / historical game slate |
espn_{prefix}_team_schedule(team_id=, season=) | Full team schedule for a season |
espn_{prefix}_teams_site() | All teams in the league (name, abbrev, logo, team_id) |
espn_{prefix}_standings() | Conference / division standings table |
espn_{prefix}_summary(event_id=) | Full game summary (~700 KB β box score, plays, leaders) |
espn_{prefix}_team_roster(team_id=, season=) | Roster for one team / season |
espn_{prefix}_game_plays(event_id=) | Play-by-play for one game |
espn_{prefix}_leaders() | League statistical leaders |
espn_{prefix}_rankings() | Polls / rankings (NCAA leagues) |
espn_{prefix}_news() | League news feed |
espn_{prefix}_injuries() | Injury report |
espn_{prefix}_player_info(athlete_id=) | Single-player bio / current info |
π Setupβ
pip install sportsdataverse
No API key required β all seven leagues hit ESPN's public endpoints.
import polars as pl
# Spring / pro football
import sportsdataverse.football.ufl as ufl
import sportsdataverse.football.xfl as xfl
import sportsdataverse.football.cfl as cfl
# College baseball + softball
import sportsdataverse.baseball.college_baseball as cbb
import sportsdataverse.baseball.college_softball as cbs
# NCAA hockey
import sportsdataverse.hockey.mch as mch
import sportsdataverse.hockey.wch as wch
pl.Config.set_tbl_rows(10)
print('sportsdataverse loaded β seven ESPN expansion leagues ready π')
sportsdataverse loaded β seven ESPN expansion leagues ready π
ESPN's live endpoints are seasonal and occasionally rate-limited, so a tiny
safe() helper runs each call defensively β you get the result when the feed
is up, and a friendly one-liner when it isn't (never a scary traceback). π
We also pin to a known completed slate for each league so code examples render consistently whether you run this in-season or in the off-season.
def safe(label, thunk):
try:
out = thunk()
print(f'β
{label}')
return out
except Exception as e: # noqa: BLE001 -- demo resilience
print(f'