Skip to main content
Version: 0.0.55

CFB — additional Python functions

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

Play-by-play, schedule & rosters

espn_cfb_game_rosters(game_id: 'int', raw=False, return_as_pandas=False, **kwargs) -> 'pl.DataFrame'

espn_cfb_game_rosters() - Pull the game by id.

Parameters

ParameterTypeDefaultDescription
game_idintUnique game_id, can be obtained from espn_cfb_schedule().
rawFalse
return_as_pandasboolFalseIf True, returns a pandas dataframe. If False, returns a polars dataframe.

Returns

Polars dataframe of game roster data with columns: 'athlete_id', 'athlete_uid', 'athlete_guid', 'athlete_type', 'first_name', 'last_name', 'full_name', 'athlete_display_name', 'short_name', 'weight', 'display_weight', 'height', 'display_height', 'age', 'date_of_birth', 'slug', 'jersey', 'linked', 'active', 'alternate_ids_sdr', 'birth_place_city', 'birth_place_state', 'birth_place_country', 'headshot_href', 'headshot_alt', 'experience_years', 'experience_display_value', 'experience_abbreviation', 'status_id', 'status_name', 'status_type', 'status_abbreviation', 'hand_type', 'hand_abbreviation', 'hand_display_value', 'draft_display_text', 'draft_round', 'draft_year', 'draft_selection', 'player_id', 'starter', 'valid', 'did_not_play', 'display_name', 'ejected', 'athlete_href', 'position_href', 'statistics_href', 'team_id', 'team_guid', 'team_uid', 'team_slug', 'team_location', 'team_name', 'team_nickname', 'team_abbreviation', 'team_display_name', 'team_short_display_name', 'team_color', 'team_alternate_color', 'is_active', 'is_all_star', 'team_alternate_ids_sdr', 'logo_href', 'logo_dark_href', 'game_id'

col_nametypedescription
athlete_idintegerESPN athlete id.
athlete_uidcharacterESPN athlete UID (universal identifier).
athlete_guidcharacterESPN athlete GUID.
athlete_typecharacterAthlete type / class.
first_namecharacterAthlete first name.
last_namecharacterAthlete last name.
full_namecharacterVenue full name (e.g. Tenney Stadium).
athlete_display_namecharacterPlayer display name; athlete_detail = TRUE only.
short_namecharacterRanking source short name (e.g. AP Poll).
weightdoubleListed weight (lbs).
display_weightcharacterHuman-readable weight (e.g. 205 lbs).
heightdoubleListed height (inches).
display_heightcharacterHuman-readable height (e.g. 6' 1").
slugcharacterURL slug for the team.
jerseycharacterJersey number.
linkedlogicalTRUE if the record is linked to a related entity.
activelogicalTRUE if the player was active for the game.
alternate_ids_sdrcharacter
birth_place_citycharacterBirth place city.
birth_place_statecharacterBirth place state.
birth_place_countrycharacterBirth place country.
birth_country_alternate_idcharacter
birth_country_abbreviationcharacter
headshot_hrefcharacterURL of the athlete headshot image.
headshot_altcharacterAlternative-text label for the headshot.
flag_hrefcharacter
flag_altcharacter
flag_relcharacter
experience_yearsintegerYears of experience.
experience_display_valuecharacterExperience display value.
experience_abbreviationcharacterExperience abbreviation.
status_idcharacterESPN commitment status id.
status_namecharacterStatus-type key (e.g. STATUS_FINAL).
status_typecharacterStatus type.
status_abbreviationcharacterStatus abbreviation.
hand_typecharacterHand type.
hand_abbreviationcharacterHand abbreviation.
hand_display_valuecharacterHand display value.
ageintegerPlayer age (in years).
date_of_birthcharacterPlayer date of birth (if published).
starterlogicalTRUE if the athlete started the game.
jersey_rightcharacter
validlogicalTRUE if the roster entry is flagged valid by ESPN.
did_not_playlogicalTRUE if the athlete did not play.
display_namecharacterHuman-readable metric name.
athlete_hrefcharacter
position_hrefcharacter
statistics_hrefcharacter
team_idintegerESPN team id.
orderintegerTeam order within the competition (0 = first).
home_awaycharacterhome or away.
winnerlogicalTRUE if this team won the game.
team_guidcharacterESPN team GUID.
team_uidcharacterESPN universal team identifier (UID format 's:40~l:...~t:...').
team_slugcharacterTeam slug for the stat row.
team_locationcharacterTeam location / school name; team_detail = TRUE only.
team_namecharacterTeam nickname; team_detail = TRUE only.
team_nicknamecharacterTeam nickname label; team_detail = TRUE only.
team_abbreviationcharacterTeam abbreviation; team_detail = TRUE only.
team_display_namecharacterFull team display name; team_detail = TRUE only.
team_short_display_namecharacterShort team display name; team_detail = TRUE only.
team_colorcharacterPrimary team color; team_detail = TRUE only.
team_alternate_colorcharacterAlternate team color; team_detail = TRUE only.
is_activelogicalWhether the team is currently active.
is_all_starlogicalWhether the team is an all-star team.
team_alternate_ids_sdrcharacter
logo_hrefcharacterURL of the default team logo.
logo_dark_hrefcharacterURL of the dark-variant team logo.
game_idintegerESPN game identifier.

Example

from sportsdataverse.cfb import espn_cfb_game_rosters
rosters = espn_cfb_game_rosters(game_id=401628334)
print(rosters.shape)

Pandas round-trip::

rosters_pd = espn_cfb_game_rosters(game_id=401628334, return_as_pandas=True)
rosters_pd.head()

Pipeline next step (filter to game starters)::

import polars as pl
starters = espn_cfb_game_rosters(game_id=401628334).filter(
pl.col("starter") == True
)

espn_cfb_play_participants(game_id: 'int', *, raw: 'bool' = False, return_as_pandas: 'bool' = False, resolve_missing: 'bool' = True, resolve_missing_max: 'int' = 50, **kwargs: 'Any') -> 'pl.DataFrame | pd.DataFrame | dict[str, Any]'

Pull ESPN per-play participants for a college-football game.

Parameters

ParameterTypeDefaultDescription
game_idintESPN game / event identifier.
rawboolFalseIf True, returns the raw list of play-items dicts (after following pagination) before any flattening.
return_as_pandasboolFalseIf True, returns a pandas DataFrame; otherwise polars.
resolve_missingboolTrueIf True (default), athletes that the cdn.espn.com sidecar omits are fetched one-by-one from their canonical ESPN $ref URL so the resulting frame has populated *_player_name / *_player_names columns wherever an *_player_id is non-null. Setting this to False skips the extra HTTP fan-out and reproduces the pre-enhancement behavior — rows may then ship with *_player_id populated but *_player_name null on the handful of athletes the sidecar misses (most visible on split sacks, multi-lateral returns, and older games).
resolve_missing_maxint50Hard cap on the number of per-athlete $ref requests issued for a single game. Defaults to 50, which comfortably covers every probed game (typical max is ≤8 unique missing athletes). If breached, a warning is logged and the remaining missing athletes are left with null names. Ignored when resolve_missing=False.

Returns

Polars (or pandas) DataFrame, one row per play. Columns include game_id, play_id, and TWO column families for every participant type ESPN ships for the game (typical types: passer, rusher, receiver, tackler, sacked_by, forced_by, pass_defender, kicker, punter, returner, recoverer, scorer, pat_scorer, penalized, assisted_by): * Scalar{type}_player_id / {type}_player_name: the first occurrence of that participant type on the play. Backwards compatible with the legacy regex-extractor shape. * List{type}_player_ids / {type}_player_names: List(Utf8) columns containing every occurrence of that participant type on the play, in the order ESPN shipped them. Plays with no participant of a given type carry an empty list [] (not null) for downstream consumption simplicity. This family preserves multi-entry participant types (split sacks where ESPN ships two sackedBy entries, multi-tacklers, etc.) that the scalar family collapses to first-only. If raw=True, returns the parsed JSON list of play dicts.

col_nametypedescription
game_idintegerESPN game identifier.
play_idintegerESPN play id.
kicker_player_namecharacter
passer_player_namecharacterName of the passer on a passing play.
receiver_player_namecharacterName of the receiver on a passing play.
rusher_player_namecharacterName of the rusher on a rushing play.
scorer_player_namecharacter
returner_player_namecharacter
pass_defender_player_namecharacter
penalized_player_namecharacter
sacked_by_player_namecharacter
pat_scorer_player_namecharacter
punter_player_namecharacterName of the punter.
kicker_player_idcharacter
passer_player_idcharacter
receiver_player_idcharacter
rusher_player_idcharacter
scorer_player_idcharacter
returner_player_idcharacter
pass_defender_player_idcharacter
penalized_player_idcharacter
sacked_by_player_idcharacter
pat_scorer_player_idcharacter
punter_player_idcharacter
kicker_player_namescharacter
passer_player_namescharacter
receiver_player_namescharacter
rusher_player_namescharacter
scorer_player_namescharacter
returner_player_namescharacter
pass_defender_player_namescharacter
penalized_player_namescharacter
sacked_by_player_namescharacter
pat_scorer_player_namescharacter
punter_player_namescharacter
kicker_player_idscharacter
passer_player_idscharacter
receiver_player_idscharacter
rusher_player_idscharacter
scorer_player_idscharacter
returner_player_idscharacter
pass_defender_player_idscharacter
penalized_player_idscharacter
sacked_by_player_idscharacter
pat_scorer_player_idscharacter
punter_player_idscharacter

Example

from sportsdataverse.cfb import espn_cfb_play_participants
participants = espn_cfb_play_participants(game_id=401628334)
print(participants.shape)

Skip the per-athlete fan-out for speed::

participants_fast = espn_cfb_play_participants(
game_id=401628334,
resolve_missing=False,
)

Pipeline next step (join onto play-by-play frame)::

from sportsdataverse.cfb import CFBPlayProcess
pbp = CFBPlayProcess(gameId=401628334).espn_cfb_pbp()
plays = pbp["plays"]
joined = plays.join(participants, how="left", left_on="id", right_on="play_id")

espn_cfb_player_stats(athlete_id: 'int', season: 'int', *, season_type: 'str' = 'regular', total: 'bool' = False, raw: 'bool' = False, return_as_pandas: 'bool' = False, **kwargs: 'Any') -> 'pl.DataFrame | pd.DataFrame | dict[str, Any]'

Pull a college-football athlete's ESPN season stat line.

See :func:sportsdataverse.wbb.espn_wbb_player_stats for full documentation of the wide return shape, the {category}_{stat} stat columns (for football: passing_*, rushing_*, receiving_*, scoring_*, ...), the athlete / team metadata blocks, and the season_type / total parameters. For the richer multi-category web-v3 payload use :func:sportsdataverse.cfb.espn_cfb_player_stats_v3.

Parameters

ParameterTypeDefaultDescription
athlete_idintESPN college-football athlete identifier.
seasonintSeason year, used in the core-v2 path.
season_typestr'regular'"regular" (type 2) or "postseason" (type 3).
totalboolFalseForward-compat totals passthrough.
rawboolFalseIf True, returns the raw core-v2 statistics JSON dict.
return_as_pandasboolFalseIf True, returns a pandas DataFrame; else polars.

Returns

A single-row wide DataFrame (polars by default). When raw=True returns the raw statistics JSON dict.

col_nametypedescription
seasonintegerSeason (4-digit year).
season_typecharacterESPN season type (2 = regular, 3 = postseason).
totallogicalTotal.
athlete_idintegerESPN athlete id.
athlete_uidcharacterESPN athlete UID (universal identifier).
athlete_guidcharacterESPN athlete GUID.
athlete_typecharacterAthlete type / class.
first_namecharacterAthlete first name.
last_namecharacterAthlete last name.
full_namecharacterVenue full name (e.g. Tenney Stadium).
display_namecharacterHuman-readable metric name.
short_namecharacterRanking source short name (e.g. AP Poll).
weightdoubleListed weight (lbs).
display_weightcharacterHuman-readable weight (e.g. 205 lbs).
heightdoubleListed height (inches).
display_heightcharacterHuman-readable height (e.g. 6' 1").
ageintegerPlayer age (in years).
date_of_birthcharacterPlayer date of birth (if published).
jerseycharacterJersey number.
slugcharacterURL slug for the team.
activelogicalTRUE if the player was active for the game.
position_idintegerESPN position id.
position_namecharacterPosition name (e.g. Quarterback); position_detail = TRUE only.
position_display_namecharacterHuman-readable position name; position_detail = TRUE only.
position_abbreviationcharacterPosition abbreviation (e.g. QB); position_detail = TRUE only.
college_namecharacterCollege name.
status_idintegerESPN commitment status id.
status_namecharacterStatus-type key (e.g. STATUS_FINAL).
general_fumblesdouble
general_fumbles_lostdouble
general_fumbles_touchdownsdouble
general_games_playeddoubleGames Played.
general_offensive_two_pt_returnsdouble
general_offensive_fumbles_touchdownsdouble
general_defensive_fumbles_touchdownsdouble
passing_avg_gaindouble
passing_completion_pctdouble
passing_completionsdoublePass completions (split from CFBD's C/ATT field).
passing_espnqb_ratingdouble
passing_interception_pctdouble
passing_interceptionsdouble
passing_long_passingdouble
passing_net_passing_yardsdouble
passing_net_passing_yards_per_gamedouble
passing_net_total_yardsdouble
passing_net_yards_per_gamedouble
passing_passing_attemptsdouble
passing_passing_big_playsdouble
passing_passing_first_downsdouble
passing_passing_fumblesdouble
passing_passing_fumbles_lostdouble
passing_passing_touchdown_pctdouble
passing_passing_touchdownsdouble
passing_passing_yardsdouble
passing_passing_yards_after_catchdouble
passing_passing_yards_at_catchdouble
passing_passing_yards_per_gamedouble
passing_qb_ratingdouble
passing_sacksdouble
passing_sack_yards_lostdouble
passing_team_games_playeddouble
passing_total_offensive_playsdouble
passing_total_points_per_gamedouble
passing_total_touchdownsdouble
passing_total_yardsdouble
passing_total_yards_from_scrimmagedouble
passing_two_point_pass_convsdouble
passing_two_pt_passdouble
passing_two_pt_pass_attemptsdouble
passing_yards_from_scrimmage_per_gamedouble
passing_yards_per_completiondouble
passing_yards_per_gamedouble
passing_yards_per_pass_attemptdouble
passing_net_yards_per_pass_attemptdouble
passing_qbrdoubleESPN Quarterback Rating (QBR) for the player in this game.
passing_adj_qbrdouble
passing_quarterback_ratingdouble
rushing_avg_gaindouble
rushing_espnrb_ratingdouble
rushing_long_rushingdouble
rushing_net_total_yardsdouble
rushing_net_yards_per_gamedouble
rushing_rushing_attemptsdouble
rushing_rushing_big_playsdouble
rushing_rushing_first_downsdouble
rushing_rushing_fumblesdouble
rushing_rushing_fumbles_lostdouble
rushing_rushing_touchdownsdouble
rushing_rushing_yardsdouble
rushing_rushing_yards_per_gamedouble
rushing_stuffsdouble
rushing_stuff_yards_lostdouble
rushing_team_games_playeddouble
rushing_total_offensive_playsdouble
rushing_total_points_per_gamedouble
rushing_total_touchdownsdouble
rushing_total_yardsdouble
rushing_total_yards_from_scrimmagedouble
rushing_two_point_rush_convsdouble
rushing_two_pt_rushdouble
rushing_two_pt_rush_attemptsdouble
rushing_yards_from_scrimmage_per_gamedouble
rushing_yards_per_gamedouble
rushing_yards_per_rush_attemptdouble
receiving_avg_gaindouble
receiving_espnwr_ratingdouble
receiving_long_receptiondouble
receiving_net_total_yardsdouble
receiving_net_yards_per_gamedouble
receiving_receiving_big_playsdouble
receiving_receiving_first_downsdouble
receiving_receiving_fumblesdouble
receiving_receiving_fumbles_lostdouble
receiving_receiving_targetsdouble
receiving_receiving_touchdownsdouble
receiving_receiving_yardsdouble
receiving_receiving_yards_after_catchdouble
receiving_receiving_yards_at_catchdouble
receiving_receiving_yards_per_gamedouble
receiving_receptionsdouble
receiving_team_games_playeddouble
receiving_total_offensive_playsdouble
receiving_total_points_per_gamedouble
receiving_total_touchdownsdouble
receiving_total_yardsdouble
receiving_total_yards_from_scrimmagedouble
receiving_two_point_rec_convsdouble
receiving_two_pt_receptiondouble
receiving_two_pt_reception_attemptsdouble
receiving_yards_from_scrimmage_per_gamedouble
receiving_yards_per_gamedouble
receiving_yards_per_receptiondouble
scoring_defensive_pointsdouble
scoring_field_goalsdouble
scoring_kick_extra_pointsdouble
scoring_kick_extra_points_madedouble
scoring_misc_pointsdouble
scoring_passing_touchdownsdouble
scoring_receiving_touchdownsdouble
scoring_return_touchdownsdouble
scoring_rushing_touchdownsdouble
scoring_total_pointsdouble
scoring_total_points_per_gamedouble
scoring_total_touchdownsdouble
scoring_total_two_point_convsdouble
scoring_two_point_pass_convsdouble
scoring_two_point_rec_convsdouble
scoring_two_point_rush_convsdouble
scoring_one_pt_safeties_madedouble
team_idintegerESPN team id.
team_uidcharacterESPN universal team identifier (UID format 's:40~l:...~t:...').
team_guidcharacterESPN team GUID.
team_slugcharacterTeam slug for the stat row.
team_locationcharacterTeam location / school name; team_detail = TRUE only.
team_namecharacterTeam nickname; team_detail = TRUE only.
team_abbreviationcharacterTeam abbreviation; team_detail = TRUE only.
team_display_namecharacterFull team display name; team_detail = TRUE only.
team_short_display_namecharacterShort team display name; team_detail = TRUE only.
team_colorcharacterPrimary team color; team_detail = TRUE only.
team_alternate_colorcharacterAlternate team color; team_detail = TRUE only.
team_is_activelogicalTRUE if the team is currently active.
team_logo_hrefcharacterDefault team logo URL; team_detail = TRUE only.

Example

from sportsdataverse.cfb import espn_cfb_player_stats
df = espn_cfb_player_stats(athlete_id=4426338, season=2023)
df.select(["full_name", "team_display_name", "passing_passing_yards"])

espn_cfb_schedule(dates=None, week=None, season_type=None, groups=None, limit=500, return_as_pandas=False, **kwargs) -> 'pl.DataFrame'

espn_cfb_schedule - look up the college football schedule for a given season

Parameters

ParameterTypeDefaultDescription
datesintNoneUsed to define different seasons. 2002 is the earliest available season.
weekintNoneWeek of the schedule.
season_typeintNone2 for regular season, 3 for post-season, 4 for off-season.
groupsintNoneUsed to define different divisions. 80 is FBS, 81 is FCS.
limitint500number of records to return, default: 500.
return_as_pandasboolFalseIf True, returns a pandas dataframe. If False, returns a polars dataframe.

Returns

Polars dataframe containing schedule dates for the requested season. Returns None if no games

col_nametypedescription
idcharacter247Sports referencing id for the recruit.
uidcharacterESPN global unique identifier.
datecharacterDate of the poll release.
attendanceintegerReported attendance at the game.
time_validlogicalTime valid.
date_validlogical
neutral_sitelogicalTRUE/FALSE flag for if the game took place at a neutral site.
conference_competitionlogicalConference competition.
play_by_play_availablelogicalTRUE if play-by-play is available.
recentlogicalRecent.
start_datecharacterSeason start timestamp (ISO 8601, UTC).
broadcastcharacterBroadcast network short name.
highlightscharacterGame highlight urls.
notes_typecharacterNotes type.
notes_headlinecharacterNotes headline.
broadcast_marketcharacterBroadcast market label (e.g. 'national', 'home').
broadcast_namecharacterBroadcast name.
type_idcharacterPlay-type id.
type_abbreviationcharacterPlay-type abbreviation (e.g. RUSH, TD).
venue_idcharacterReferencing venue id.
venue_full_namecharacterVenue full name.
venue_address_citycharacterVenue address city.
venue_address_countrycharacter
venue_indoorlogicalWhether the home venue is indoors.
status_clockdoubleStatus clock.
status_display_clockcharacterStatus display clock.
status_periodintegerStatus period.
status_type_idcharacterUnique identifier for status type.
status_type_namecharacterStatus type name.
status_type_statecharacterStatus type state.
status_type_completedlogicalStatus type completed.
status_type_descriptioncharacterStatus type description.
status_type_detailcharacterStatus type detail.
status_type_short_detailcharacterStatus type short detail.
format_regulation_periodsintegerFormat regulation periods.
home_idcharacterHome team referencing id.
home_uidcharacterHome team's uid.
home_locationcharacterHome team's location.
home_namecharacterHome name.
home_abbreviationcharacterHome team's abbreviation.
home_display_namecharacterHome display name.
home_short_display_namecharacterHome short display name.
home_colorcharacterColor code (hex) for home.
home_alternate_colorcharacterColor code (hex) for home alternate.
home_is_activelogicalHome team's is active.
home_venue_idcharacterUnique identifier for home venue.
home_logocharacterHome team logo URL.
home_conference_idcharacterUnique identifier for home conference.
home_scorecharacterHome-team score after the play.
home_current_rankinteger
home_linescoresinteger
home_recordscharacter
away_idcharacterAway team referencing id.
away_uidcharacterAway team's uid.
away_locationcharacterAway team's location.
away_namecharacterAway name.
away_abbreviationcharacterAway team's abbreviation.
away_display_namecharacterAway display name.
away_short_display_namecharacterAway short display name.
away_colorcharacterColor code (hex) for away.
away_alternate_colorcharacterColor code (hex) for away alternate.
away_is_activelogicalAway team's is active.
away_venue_idcharacterUnique identifier for away venue.
away_logocharacterAway team logo URL.
away_conference_idcharacterUnique identifier for away conference.
away_scorecharacterAway-team score after the play.
away_current_rankinteger
away_linescoresinteger
away_recordscharacter
game_idintegerESPN game identifier.
seasonintegerSeason (4-digit year).
season_typeintegerESPN season type (2 = regular, 3 = postseason).
weekintegerGame week of the season.
venue_address_statecharacterVenue address state / region.
groups_idcharacterUnique identifier for groups.
groups_namecharacterGroups name.
groups_short_namecharacterGroups short name.
groups_is_conferencelogicalGroups is conference.

Example

from sportsdataverse.cfb import espn_cfb_schedule
slate = espn_cfb_schedule()
print(slate.shape if slate is not None else "no games")

Pull a specific week of FBS games::

week5 = espn_cfb_schedule(dates=2023, week=5, season_type=2)

Pipeline next step (extract finals only)::

import polars as pl
finals = espn_cfb_schedule(dates=2023, week=5).filter(
pl.col("status_type_completed") == True
)

Dataset loaders

load_cfb_betting_lines(return_as_pandas=False) -> 'pl.DataFrame'

Load college football betting lines information

Parameters

ParameterTypeDefaultDescription
return_as_pandasboolFalseIf True, returns a pandas dataframe. If False, returns a polars dataframe.

Returns

Polars dataframe containing betting lines available for the available seasons.

col_nametypedescription
iddouble247Sports referencing id for the recruit.
game_idintegerESPN game identifier.
seasondoubleSeason (4-digit year).
game_desccharacter
date_timecharacter
market_typecharacterGeographic market type (e.g. National).
abbrcharacter
linesdouble
oddsinteger
opening_linesdouble
opening_oddsinteger
bookcharacter
season_typecharacterESPN season type (2 = regular, 3 = postseason).
weekintegerGame week of the season.

Example

from sportsdataverse.cfb import load_cfb_betting_lines
lines = load_cfb_betting_lines()
print(lines.shape)

Pandas round-trip::

lines_pd = load_cfb_betting_lines(return_as_pandas=True)
lines_pd.head()

Pipeline next step (filter to one provider in 2023)::

import polars as pl
consensus_2023 = load_cfb_betting_lines().filter(
(pl.col("season") == 2023) & (pl.col("provider") == "consensus")
)

Utilities & helpers

CFBPlayProcess(gameId=0, raw=False, path_to_json='/', return_keys=None, odds_override=None, **kwargs)

No description available.

Parameters

ParameterTypeDefaultDescription
gameId0
rawFalse
path_to_json'/'
return_keysNone
odds_overrideNone

most_recent_cfb_season()

Return the most recent college football season year based on today's date.

The college football season starts in mid-August. If today is on or after August 15 (or any day in September or later), this returns the current calendar year. Otherwise, it returns the previous calendar year.

Returns

The most recent CFB season year.

Example

from sportsdataverse.cfb import most_recent_cfb_season
year = most_recent_cfb_season()
print(year)

Combine with the loaders for a "current season" pull::

from sportsdataverse.cfb import load_cfb_schedule, most_recent_cfb_season
sched = load_cfb_schedule(seasons=[most_recent_cfb_season()])

Other

espn_cfb_teams(groups=None, return_as_pandas=False, **kwargs) -> 'pl.DataFrame'

espn_cfb_teams - look up the college football teams

Parameters

ParameterTypeDefaultDescription
groupsintNoneUsed to define different divisions. 80 is FBS, 81 is FCS.
return_as_pandasboolFalseIf True, returns a pandas dataframe. If False, returns a polars dataframe.

Returns

Polars dataframe containing schedule dates for the requested season. This function caches by default, so if you want to refresh the data, use the command sportsdataverse.cfb.espn_cfb_teams.clear_cache().

col_nametypedescription
team_abbreviationcharacterTeam abbreviation; team_detail = TRUE only.
team_alternate_colorcharacterAlternate team color; team_detail = TRUE only.
team_colorcharacterPrimary team color; team_detail = TRUE only.
team_display_namecharacterFull team display name; team_detail = TRUE only.
team_idcharacterESPN team id.
team_is_activelogicalTRUE if the team is currently active.
team_is_all_starlogicalTRUE if the row represents an All-Star team.
team_locationcharacterTeam location / school name; team_detail = TRUE only.
team_logosinteger
team_namecharacterTeam nickname; team_detail = TRUE only.
team_nicknamecharacterTeam nickname label; team_detail = TRUE only.
team_short_display_namecharacterShort team display name; team_detail = TRUE only.
team_slugcharacterTeam slug for the stat row.
team_uidcharacterESPN universal team identifier (UID format 's:40~l:...~t:...').

Example

from sportsdataverse.cfb import espn_cfb_teams
teams = espn_cfb_teams()
print(teams.shape)

Pull FCS teams (group 81)::

fcs = espn_cfb_teams(groups=81, return_as_pandas=True)
fcs.head()

Pipeline next step (build an abbreviation lookup)::

teams = espn_cfb_teams()
abbr_map = dict(zip(teams["team_id"], teams["team_abbreviation"]))

get_cfb_teams(return_as_pandas=False) -> 'pl.DataFrame'

Load college football team ID information and logos

Parameters

ParameterTypeDefaultDescription
return_as_pandasboolFalseIf True, returns a pandas dataframe. If False, returns a polars dataframe.

Returns

Polars dataframe containing teams available.

col_nametypedescription
team_idintegerESPN team id.
schoolcharacterTeam name.
mascotcharacterTeam mascot.
abbreviationcharacterMetric abbreviation.
alt_name1characterTeam alternate name 1 (as it appears in play_text).
alt_name2characterTeam alternate name 2 (as it appears in play_text).
alt_name3characterTeam alternate name 3 (as it appears in play_text).
conferencecharacterConference of the team.
divisioncharacterDivision in the conference for the team.
colorcharacterPrimary team color (hex, no #).
alt_colorcharacterTeam color (alternate).
logocharacterTeam or league logo URL.
logo_darkcharacterDark-mode logo URL.

Example

from sportsdataverse.cfb import get_cfb_teams
teams = get_cfb_teams()
print(teams.shape)

Pandas round-trip::

teams_pd = get_cfb_teams(return_as_pandas=True)
teams_pd.head()

Pipeline next step (build a team_id to logo URL map)::

teams = get_cfb_teams()
logo_map = dict(zip(teams["team_id"], teams["logo"]))

scoreboard_event_parsing(event)

Internal helper that flattens an ESPN scoreboard event dict into a shape

suitable for pd.json_normalize.

Parameters

ParameterTypeDefaultDescription
eventdictA single scoreboard events[*] entry from the ESPN college-football scoreboard API.

Returns

The same event dict, mutated in place with home/away copies of the competitors and trimmed of unused link/odds keys.

Example

from sportsdataverse.cfb import espn_cfb_schedule
sched = espn_cfb_schedule(dates=2023, week=5)