CFB — additional Python functions — Analytics: add_play–cfb_returning
add_play_type_canonical
add_play_type_canonical(df: 'pl.DataFrame', *, source: 'str' = 'type.text', with_family: 'bool' = True) -> 'pl.DataFrame'
Append play_type_canonical (and optionally play_type_family).
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
df | DataFrame | A play-by-play frame. | |
source | str | 'type.text' | Name of the raw play-type column. |
with_family | bool | True | Also append the coarse play_type_family column. |
Returns
The frame with the canonical column(s) appended. Returned unchanged when source is absent, so the helper is safe to apply to frames that have already been projected down.
| col_name | type | description |
|---|---|---|
season | integer | Season (4-digit year). |
game_id | integer | ESPN game identifier. |
game_play_number | integer | Sequential play number within the game (excludes timeouts/end markers). |
pos_team_id | integer | Team id of the offense (possession team) on the play. |
pos_team | character | Team name in possession at the start of the play (offense, kickoff-aware). |
def_pos_team_id | integer | Team id of the defense on the play. |
def_pos_team | character | Team name on defense at the start of the play. |
pos_team_score | integer | Score for the team in possession at the start of the play. |
def_pos_team_score | integer | Score for the defensive team at the start of the play. |
half | integer | Half indicator (1 or 2). |
period | integer | Period (quarter) number. |
down | integer | Down of the play (1-4). |
distance | integer | Yards to gain for a first down (or to the goal line in goal-to-go situations). |
EPA | double | Expected Points Added on the play (cfbfastR EPA model output). |
wpa | double | Win Probability Added on the play (cfbfastR WP model output). |
wp_before | double | Win probability for the possession team before the play (0-1). |
wp_after | double | Win probability for the possession team after the play (0-1). |
def_wp_before | double | Win probability for the defensive team before the play (0-1). |
def_wp_after | double | Win probability for the defensive team after the play (0-1). |
penalty_detail | character | Parsed penalty description extracted from play text. |
yds_penalty | character | Yardage assessed on the penalty. |
penalty_1st_conv | logical | TRUE when the penalty resulted in a first down conversion. |
new_series | logical | Binary flag for the start of a new series of downs. |
firstD_by_kickoff | logical | Binary flag for a new first down arising from a kickoff. |
firstD_by_poss | logical | Binary flag for a new first down via change of possession. |
firstD_by_penalty | logical | Binary flag for a new first down via penalty. |
firstD_by_yards | logical | Binary flag for a new first down via yards gained. |
def_EPA | double | EPA for the defensive team on the play (sign-flipped offense EPA). |
rz_play | logical | Binary flag for a red-zone play (yards_to_goal <= 20). |
scoring_opp | logical | Binary flag for a scoring opportunity (yards_to_goal <= 40). |
middle_8 | logical | TRUE for plays in the middle-8 window (final 4 min of 1H, first 4 min of 2H). |
stuffed_run | logical | Binary flag for a stuffed run (zero or negative yards gained). |
change_of_pos_team | logical | Binary flag for change of possession-team on the play. |
downs_turnover | logical | Binary flag for a turnover on downs. |
pos_score_diff_start | integer | Score differential for the possession team at the start of the play. |
pos_score_pts | integer | Points scored on the play attributed to the possession team. |
home_wp_before | double | Home team win probability before the play (0-1). |
away_wp_before | double | Away team win probability before the play (0-1). |
home_wp_after | double | Home team win probability after the play (0-1). |
away_wp_after | double | Away team win probability after the play (0-1). |
end_of_half | logical | Binary flag for the last play of a half. |
orig_play_type | character | Original CFBD play type label before cfbfastR cleaning. |
offense_score_play | logical | Binary flag for an offensive scoring play. |
defense_score_play | logical | Binary flag for a defensive scoring play. |
pos_score_diff | integer | Score differential from the possession team's perspective. |
change_of_poss | logical | Binary flag for change of possession on the play (CFBD offense field). |
rusher_player_name | character | Name of the rusher on a rushing play. |
yds_rushed | integer | Rushing yards gained on the play. |
passer_player_name | character | Name of the passer on a passing play. |
receiver_player_name | character | Name of the receiver on a passing play. |
yds_receiving | integer | Receiving yards gained on the play. |
yds_sacked | integer | Yards lost on the sack. |
sack_players | character | Combined names of all sack participants. |
sack_player_name | character | Primary sack player name. |
sack_player_name2 | character | Secondary sack player name (when split between two defenders). |
pass_breakup_player_name | character | Name of the defender credited with the pass breakup. |
interception_player_name | character | Name of the defender credited with the interception. |
yds_int_return | integer | Yards gained on an interception return. |
fumble_player_name | character | Name of the player who fumbled. |
fumble_forced_player_name | character | Name of the player who forced the fumble. |
fumble_recovered_player_name | character | Name of the player who recovered the fumble. |
yds_fumble_return | integer | Yards gained on a fumble return. |
punter_player_name | character | Name of the punter. |
yds_punted | integer | Yards the ball traveled on the punt. |
yds_punt_return | integer | Yards gained on the punt return. |
yds_punt_gained | integer | Net yards gained on the punt (punt distance minus return). |
punt_block_player_name | character | Name of the player credited with blocking the punt. |
punt_block_return_player_name | character | Name of the player returning a blocked punt. |
fg_kicker_player_name | character | Name of the field goal kicker. |
yds_fg | integer | Distance of the field goal attempt in yards. |
fg_block_player_name | character | Name of the player credited with blocking the field goal. |
fg_return_player_name | character | Name of the player returning the blocked/missed field goal. |
kickoff_player_name | character | Name of the kickoff specialist. |
yds_kickoff | integer | Yards the ball traveled on the kickoff. |
yds_kickoff_return | integer | Yards gained on the kickoff return. |
rush | logical | Binary flag for a rushing play. |
rush_td | logical | Binary flag for a rushing touchdown. |
pass | logical | Binary flag for a passing play (includes sacks). |
pass_td | logical | Binary flag for a passing touchdown. |
completion | logical | Binary flag for a completed pass. |
pass_attempt | logical | Binary flag for a pass attempt. |
target | logical | Binary flag for a targeted receiver on the play. |
sack | logical | Binary flag for a sack (duplicate of sack_vec for downstream use). |
int | logical | Binary flag for an interception. |
int_td | logical | Binary flag for an interception returned for a touchdown. |
turnover_vec | logical | Binary flag for any play classified as a turnover. |
kickoff_play | logical | Binary flag for a kickoff play. |
scoring_play | logical | TRUE if the play resulted in a score. |
td_play | logical | Binary flag for a touchdown play. |
touchdown | logical | Binary flag for a touchdown (duplicate of td_play for downstream use). |
safety | logical | Binary flag for a safety. |
fumble_vec | logical | Binary flag for a play involving a fumble. |
kickoff_tb | logical | Binary flag for a kickoff touchback. |
kickoff_onside | logical | Binary flag for an onside kickoff attempt. |
kickoff_oob | logical | Binary flag for a kickoff out of bounds. |
kickoff_fair_catch | logical | Binary flag for a kickoff fair catch. |
kickoff_downed | logical | Binary flag for a kickoff downed in the field of play. |
kickoff_safety | logical | Binary flag for a kickoff safety. |
punt | logical | Binary flag for a punt play. |
punt_play | logical | Binary flag for any punt-related play (includes blocks/returns). |
punt_tb | logical | Binary flag for a punt touchback. |
punt_oob | logical | Binary flag for a punt out of bounds. |
punt_fair_catch | logical | Binary flag for a punt fair catch. |
punt_downed | logical | Binary flag for a punt downed in the field of play. |
punt_safety | logical | Binary flag for a punt safety. |
punt_blocked | logical | Binary flag for a blocked punt. |
penalty_safety | logical | Binary flag for a safety scored on a penalty. |
fg_made | logical | TRUE when the field goal attempt was successful. |
fg_make_prob | double | Predicted probability of making the field goal (cfbfastR FG model, 0-1). |
penalty_flag | logical | TRUE when a penalty was flagged on the play. |
penalty_declined | logical | TRUE when the penalty was declined. |
penalty_no_play | logical | TRUE when the penalty nullified the play (no play counted). |
penalty_offset | logical | TRUE when offsetting penalties were called. |
penalty_text | character | TRUE when penalty information is detectable in the play text. |
lead_wp_before2 | double | Value of wp_before 2 plays ahead, used for sequence-aware derivations. |
lead_wp_before | double | Value of wp_before on the next play, used for sequence-aware derivations. |
lead_pos_team2 | integer | Value of pos_team 2 plays ahead, used for sequence-aware derivations. |
id | integer | 247Sports referencing id for the recruit. |
sequenceNumber | integer | |
text | character | Full play description. |
awayScore | integer | |
homeScore | integer | |
scoringPlay | logical | ESPN flag marking the play as a scoring play. |
priority | logical | TRUE if ESPN flags the play as a priority highlight. |
modified | character | ISO timestamp the play record was last modified. |
wallclock | character | Real-world ISO timestamp of the play. |
teamParticipants | character | Raw ESPN team-level participants payload carried through from the plays feed (stringified). |
isPenalty | logical | ESPN's per-play flag that a penalty occurred on the play. |
statYardage | integer | Yardage ESPN credits to the play for statistical purposes. |
isTurnover | logical | ESPN's per-play turnover flag as shipped in the plays feed (broader than the giveaway-based is_turnover derivation). |
type.id | character | ESPN's numeric identifier for the play type. |
type.text | character | ESPN's text label for the play type. |
type.abbreviation | character | ESPN's abbreviation for the play type. |
period.number | integer | Period (quarter) number in which the play occurred. |
clock.displayValue | character | Game clock at the play, as the displayed mm:ss string. |
start.down | integer | ESPN's down value for the play state at the start of the play. |
start.distance | integer | ESPN's distance value for the play state at the start of the play. |
start.yardLine | integer | ESPN's yardLine value for the play state at the start of the play. |
start.yardsToEndzone | integer | ESPN's yardsToEndzone value for the play state at the start of the play. |
start.team.id | integer | ESPN's team.id value for the play state at the start of the play. |
end.down | integer | ESPN's down value for the play state at the end of the play. |
end.distance | integer | ESPN's distance value for the play state at the end of the play. |
end.yardLine | integer | ESPN's yardLine value for the play state at the end of the play. |
end.yardsToEndzone | integer | ESPN's yardsToEndzone value for the play state at the end of the play. |
end.downDistanceText | character | ESPN's downDistanceText value for the play state at the end of the play. |
end.shortDownDistanceText | character | ESPN's shortDownDistanceText value for the play state at the end of the play. |
end.possessionText | character | ESPN's possessionText value for the play state at the end of the play. |
end.team.id | integer | ESPN's team.id value for the play state at the end of the play. |
start.downDistanceText | character | ESPN's downDistanceText value for the play state at the start of the play. |
start.shortDownDistanceText | character | ESPN's shortDownDistanceText value for the play state at the start of the play. |
start.possessionText | character | ESPN's possessionText value for the play state at the start of the play. |
scoringType.name | character | ESPN's name for the scoring type (e.g. touchdown, field goal). |
scoringType.displayName | character | ESPN's display label for the scoring type. |
scoringType.abbreviation | character | ESPN's abbreviation for the scoring type. |
pointAfterAttempt.id | double | ESPN identifier for the point-after attempt type on the scoring play. |
pointAfterAttempt.text | character | ESPN description of the point-after attempt and its result. |
pointAfterAttempt.abbreviation | character | ESPN abbreviation of the point-after attempt type; drives the extra-point / two-point result derivation. |
pointAfterAttempt.value | double | Points ESPN credits for the point-after attempt (1.0 made extra point, 2.0 made two-point try). |
drive.id | character | ESPN's id field for the drive containing this play. |
drive.displayResult | character | ESPN's displayResult field for the drive containing this play. |
drive.isScore | logical | ESPN's isScore field for the drive containing this play. |
drive.team.shortDisplayName | character | ESPN's team.shortDisplayName field for the drive containing this play. |
drive.team.displayName | character | ESPN's team.displayName field for the drive containing this play. |
drive.team.name | character | ESPN's team.name field for the drive containing this play. |
drive.team.abbreviation | character | ESPN's team.abbreviation field for the drive containing this play. |
drive.yards | integer | ESPN's yards field for the drive containing this play. |
drive.offensivePlays | integer | ESPN's offensivePlays field for the drive containing this play. |
drive.result | character | ESPN's result field for the drive containing this play. |
drive.description | character | ESPN's description field for the drive containing this play. |
drive.shortDisplayResult | character | ESPN's shortDisplayResult field for the drive containing this play. |
drive.timeElapsed.displayValue | character | ESPN's timeElapsed.displayValue field for the drive containing this play. |
drive.start.period.number | integer | ESPN's start.period.number field for the drive containing this play. |
drive.start.period.type | character | ESPN's start.period.type field for the drive containing this play. |
drive.start.yardLine | integer | ESPN's start.yardLine field for the drive containing this play. |
drive.start.clock.displayValue | character | ESPN's start.clock.displayValue field for the drive containing this play. |
drive.start.text | character | ESPN's start.text field for the drive containing this play. |
drive.end.period.number | integer | ESPN's end.period.number field for the drive containing this play. |
drive.end.period.type | character | ESPN's end.period.type field for the drive containing this play. |
drive.end.yardLine | integer | ESPN's end.yardLine field for the drive containing this play. |
drive.end.clock.displayValue | character | ESPN's end.clock.displayValue field for the drive containing this play. |
seasonType | integer | ESPN season type for the game (2 = regular season, 3 = postseason). |
week | integer | Game week of the season. |
status_type_completed | logical | |
homeTeamId | integer | ESPN's home-team Id for the game, stamped on every play. |
awayTeamId | integer | ESPN's away-team Id for the game, stamped on every play. |
homeFinalScore | integer | Final score of the home team from the ESPN game header, repeated on every play of the game; the processing step checks the running score at the last play against it. |
awayFinalScore | integer | Final score of the away team from the ESPN game header, repeated on every play of the game; the processing step checks the running score at the last play against it. |
homeTeamName | character | ESPN's home-team Name for the game, stamped on every play. |
awayTeamName | character | ESPN's away-team Name for the game, stamped on every play. |
homeTeamMascot | character | ESPN's home-team Mascot for the game, stamped on every play. |
awayTeamMascot | character | ESPN's away-team Mascot for the game, stamped on every play. |
homeTeamAbbrev | character | ESPN's home-team Abbrev for the game, stamped on every play. |
awayTeamAbbrev | character | ESPN's away-team Abbrev for the game, stamped on every play. |
homeTeamNameAlt | character | ESPN's home-team NameAlt for the game, stamped on every play. |
awayTeamNameAlt | character | ESPN's away-team NameAlt for the game, stamped on every play. |
gameSpread | double | Point spread used as an input to the win-probability model. |
homeFavorite | logical | True when the home team was favoured by the spread. |
gameSpreadAvailable | logical | True when a spread was available for the game. |
overUnder | double | Over/under total used as a model input. |
homeTeamSpread | double | ESPN's home-team Spread for the game, stamped on every play. |
clock.minutes | integer | Minutes remaining on the game clock at the play. |
clock.seconds | integer | Seconds component of the game clock at the play. |
lag_half | integer | Value of half on the previous play, used for sequence-aware derivations. |
lead_half | integer | Value of half on the next play, used for sequence-aware derivations. |
start.TimeSecsRem | integer | Seconds remaining in the half from ESPN's clock stamp for this play, which is the end-of-play time in 2005 and 2007+ (the snap time in 2004 and most of 2006); tops out at 1800. |
start.adj_TimeSecsRem | integer | ESPN's adj_TimeSecsRem value for the play state at the start of the play. |
lead_text | character | Value of text on the next play, used for sequence-aware derivations. |
lead_start_team | character | Value of start_team on the next play, used for sequence-aware derivations. |
lead_start_yardsToEndzone | integer | Value of start_yardsToEndzone on the next play, used for sequence-aware derivations. |
lead_start_down | integer | Value of start_down on the next play, used for sequence-aware derivations. |
lead_start_distance | integer | Value of start_distance on the next play, used for sequence-aware derivations. |
lead_scoringPlay | logical | Value of scoringPlay on the next play, used for sequence-aware derivations. |
text_dupe | logical | Always False in the emitted frame -- the duplicate-row filter it gates runs before the column is returned, so it marks nothing and is retained only for schema stability. |
end_state_missing | logical | Flag that ESPN's end-of-play state (end.team.id) was absent and the end state was imputed. |
start.pos_team.id | integer | ESPN's pos_team.id value for the play state at the start of the play. |
start.def_pos_team.id | integer | ESPN's def_pos_team.id value for the play state at the start of the play. |
end.def_pos_team.id | integer | ESPN's def_pos_team.id value for the play state at the end of the play. |
end.pos_team.id | integer | ESPN's pos_team.id value for the play state at the end of the play. |
start.pos_team.name | character | ESPN's pos_team.name value for the play state at the start of the play. |
start.def_pos_team.name | character | ESPN's def_pos_team.name value for the play state at the start of the play. |
end.pos_team.name | character | ESPN's pos_team.name value for the play state at the end of the play. |
end.def_pos_team.name | character | ESPN's def_pos_team.name value for the play state at the end of the play. |
start.is_home | logical | ESPN's is_home value for the play state at the start of the play. |
end.is_home | logical | ESPN's is_home value for the play state at the end of the play. |
homeTimeoutCalled | logical | True when the home team called a timeout on the play. |
awayTimeoutCalled | logical | True when the away team called a timeout on the play. |
end.homeTeamTimeouts | integer | ESPN's homeTeamTimeouts value for the play state at the end of the play. |
end.awayTeamTimeouts | integer | ESPN's awayTeamTimeouts value for the play state at the end of the play. |
start.homeTeamTimeouts | integer | ESPN's homeTeamTimeouts value for the play state at the start of the play. |
start.awayTeamTimeouts | integer | ESPN's awayTeamTimeouts value for the play state at the start of the play. |
end.TimeSecsRem | integer | Seconds remaining in the half carried as this play's end state; currently the preceding row's clock stamp. |
end.adj_TimeSecsRem | integer | ESPN's adj_TimeSecsRem value for the play state at the end of the play. |
start.posTeamTimeouts | integer | ESPN's posTeamTimeouts value for the play state at the start of the play. |
start.defPosTeamTimeouts | integer | ESPN's defPosTeamTimeouts value for the play state at the start of the play. |
end.posTeamTimeouts | integer | ESPN's posTeamTimeouts value for the play state at the end of the play. |
end.defPosTeamTimeouts | integer | ESPN's defPosTeamTimeouts value for the play state at the end of the play. |
firstHalfKickoffTeamId | integer | ESPN id of the team that received the opening kickoff. |
start.yard | integer | ESPN's yard value for the play state at the start of the play. |
end.yard | integer | ESPN's yard value for the play state at the end of the play. |
lag_scoringPlay | logical | Value of scoringPlay on the previous play, used for sequence-aware derivations. |
down_1 | logical | True when it is 1st down at the start of the play. |
down_2 | logical | True when it is 2nd down at the start of the play. |
down_3 | logical | True when it is 3rd down at the start of the play. |
down_4 | logical | True when it is 4th down at the start of the play. |
down_1_end | logical | True when it is 1st down at the end of the play. |
down_2_end | logical | True when it is 2nd down at the end of the play. |
down_3_end | logical | True when it is 3rd down at the end of the play. |
down_4_end | logical | True when it is 4th down at the end of the play. |
td_check | logical | Internal flag used while reconciling whether the play produced a touchdown. |
forced_fumble | logical | True when the defense forced a fumble on the play. |
is_home | logical | |
lag_HA_score_diff | integer | Value of HA_score_diff on the previous play, used for sequence-aware derivations. |
HA_score_diff | integer | Home score minus away score for the play. |
net_HA_score_pts | integer | Net points the play added to the home-minus-away score margin. |
H_score_diff | integer | Home team's score minus the away team's, from the home perspective. |
A_score_diff | integer | Away team's score minus the home team's, from the away perspective. |
lag_homeScore | integer | Value of homeScore on the previous play, used for sequence-aware derivations. |
lag_awayScore | integer | Value of awayScore on the previous play, used for sequence-aware derivations. |
start.homeScore | integer | ESPN's homeScore value for the play state at the start of the play. |
start.awayScore | integer | ESPN's awayScore value for the play state at the start of the play. |
end.homeScore | integer | ESPN's homeScore value for the play state at the end of the play. |
end.awayScore | integer | ESPN's awayScore value for the play state at the end of the play. |
start.pos_team_score | integer | ESPN's pos_team_score value for the play state at the start of the play. |
start.def_pos_team_score | integer | ESPN's def_pos_team_score value for the play state at the start of the play. |
start.pos_score_diff | integer | ESPN's pos_score_diff value for the play state at the start of the play. |
end.pos_team_score | integer | ESPN's pos_team_score value for the play state at the end of the play. |
end.def_pos_team_score | integer | ESPN's def_pos_team_score value for the play state at the end of the play. |
end.pos_score_diff | integer | ESPN's pos_score_diff value for the play state at the end of the play. |
start.pos_team_receives_2H_kickoff | logical | ESPN's pos_team_receives_2H_kickoff value for the play state at the start of the play. |
end.pos_team_receives_2H_kickoff | logical | ESPN's pos_team_receives_2H_kickoff value for the play state at the end of the play. |
penalty_in_text | logical | True when the play description mentions a penalty. |
penalty_count | integer | Number of penalties flagged on the play (0-4 observed). |
penalty_declined_count | integer | Number of the flagged penalties that were declined. |
penalty_all_declined | logical | Whether every penalty flagged on the play was declined. |
penalty_enforcement | character | How the penalty was resolved: one of no_play, declined, offsetting, negating_foul, play_stands, unknown. |
penalty_negated_play | logical | Whether the penalty negated the play's result. |
pass_breakup | logical | True when a defender broke up the pass. |
pass_depth | character | Thrown-pass depth parsed from ESPN play text ("short" or "deep"); null when the text omits it (sacks, screens, pre-2025 text). |
pass_direction | character | Pass direction parsed from ESPN play text ("left", "middle", or "right"); null when the text omits it. |
rush_direction | character | Rush direction parsed from ESPN play text ("left", "middle", or "right"); null when the text omits it. |
qb_hurry | logical | Whether ESPN's play text says the quarterback was hurried into the throw ("hurried by ..."). |
fg_attempt | logical | True when the play was a field-goal attempt. |
pos_unit | character | Possession-team unit label (offense or special teams). |
def_pos_unit | character | Defensive possession-team unit label (defense or special teams). |
sp | logical | |
play | logical | Binary flag indicating the row is a counted play (excludes end markers/timeouts/penalties). |
cleaned_text | character | Play description with overturned-call prefixes stripped; the text the name and team extractors run against. |
kneel_down | logical | Whether the play is an offensive kneel, from explicit kneel text plus an end-of-half TEAM-rush heuristic. |
scrimmage_play | logical | True when the play is a play from scrimmage rather than a special-teams or administrative row. |
pos_score_diff_end | integer | Score differential from the possessing team's perspective at the end of the play. |
fumble_lost | logical | |
fumble_recovered | logical | True when a fumble on the play was recovered. |
field_goal_result | character | |
extra_point_result | character | |
two_point_conv_result | character | String result of the two-point conversion attempt: success, failure, or safety (touchback in the defensive end zone). |
defensive_two_point_attempt | logical | |
defensive_two_point_conv | logical | |
yds_punted_source | character | Provenance of yds_punted: "text" when the value was present before the special-teams derivation step (parsed from the play text, or set by a flag convention such as a blocked punt's 0), "derived" when that step filled it from field position, null when there is no value. |
yds_kickoff_source | character | Provenance of yds_kickoff: "text" when the value was present before the special-teams derivation step (parsed from the play text, or set by a flag convention such as a blocked punt's 0), "derived" when that step filled it from field position, null when there is no value. |
yds_punt_return_source | character | Provenance of yds_punt_return: "text" when the value was present before the special-teams derivation step (parsed from the play text, or set by a flag convention such as a blocked punt's 0), "derived" when that step filled it from field position, null when there is no value. |
air_yardsToEndzone | integer | Yards to the endzone at the catch spot, parsed from the 2025+ vendor catch-spot text; null before 2025 or when unresolvable. |
air_yards | integer | |
yards_after_catch | integer | |
kickoff_return_player_name | character | Name of the player returning the kickoff, when the play was returned. |
punt_return_player_name | character | Name of the player returning the punt, when the punt was returned. |
xp_attempt | logical | Whether an extra-point kick was attempted on the play. |
xp_made | logical | Whether the extra-point kick was successful. |
xp_kicker_player_name | character | Name of the kicker attempting the extra point. |
kicking_team | integer | Team id of the kicking team on kickoff, punt, and field-goal plays. |
return_team | integer | Team id of the returning side; set on interception, fumble, kickoff, punt, and blocked-kick returns. |
fumble_or_muff | logical | Whether the play includes a fumble or a muffed kick or punt (widened beyond ESPN's fumble play types). |
recovery_team | integer | Team id parsed from the play text as recovering the fumble or muff. |
recovery_team_2 | integer | Team id of the second recovery in a multi-recovery scramble, parsed from the play text. |
penalty_spot_yardline | integer | Yard line (0-50) at which the penalty was spotted. |
penalty_spot_side | character | Side of the field the penalty was spotted on: 'home', 'away' or 'mid' (midfield). |
penalty_spot_yardsToEndzone | integer | Yards from the penalty spot to the end zone (0-100). |
fumbling_team | integer | Team id of the side that fumbled or muffed the ball, parsed from the play text. |
int_turnover | logical | Whether the play is an interception giveaway. |
pos_fumble_lost | logical | Whether the possession team fumbled and lost the ball. |
def_fumble_lost | logical | Whether the defending team (e.g. a returner after a takeaway) fumbled and lost the ball back. |
is_pos_team_turnover | logical | Whether the possession team committed a giveaway (interception or fumble lost). |
is_def_pos_team_turnover | logical | Whether the defending team gave the ball back via a lost fumble. |
is_turnover | logical | True when the play is a giveaway-based turnover (interception thrown or fumble lost); blocked kicks recovered by the defense are carried by the blocked-kick fields instead. |
turnover_team | integer | Team id charged with the giveaway on the play. |
is_st_turnover | logical | Whether the giveaway happened on a special-teams play (kick or punt snap, or a return). |
is_blocked_punt_turnover | logical | Blocked-punt possession loss (blocked-punt TD, or the defense recovered); kept out of is_turnover to match ESPN's giveaway-only box. |
is_blocked_fg_turnover | logical | Blocked-field-goal possession loss (blocked-FG TD, or the defense recovered); kept out of is_turnover to match ESPN's giveaway-only box. |
sack_team | integer | Team id credited with the sack (the defense). |
interception_team | integer | Team id credited with the interception (the defense). |
pass_breakup_team | integer | Team id credited with the pass breakup (the defense). |
forced_fumble_team | integer | Team id credited with forcing the fumble -- the side opposite the fumbling player (the covering team on returns). |
fumble_recovery_team | integer | Team id that recovered the fumble or muff, from parsed text with a giveaway / own-recovery fallback. |
punt_return_team | integer | Team id of the punt-returning side. |
kick_return_team | integer | Team id of the kick-returning side. |
fg_team | integer | Team id attempting the field goal (the kicking team). |
punt_team | integer | Team id punting the ball (the kicking team). |
penalized_team | integer | Team id the penalty was assessed against, from the home/away text resolver with a foul-direction fallback. |
penalty_yards_signed | integer | Penalty yardage parsed from the play text with era-aware bounds; the printed sign is retained but is not a reliable enforcement direction. |
penalty_side | character | Which side committed the penalty -- 'off' (offense) or 'def' (defense). |
penalty_yards_net | integer | Net yardage assessed for the penalty, signed relative to the possession team (observed -25 to 25). |
penalty_team_id | integer | Team id of the side that committed the penalty. |
new_down | integer | Down after the play, including any penalty enforcement. |
new_distance | integer | Distance to go after the play, including any penalty enforcement. |
under_2 | logical | Whether the play began with two minutes or less remaining in the half. |
goal_to_go | logical | |
stopped_run | logical | True when the rush was stopped at or behind the line of scrimmage. |
opportunity_run | logical | True when a rush reached 4 yards -- the carries on which the blocking did its job. Matches cfbfastR's espn_cfb_15 definition. Assets published before the 2026-08 fix carry the inverted (4 yards or fewer) flag. |
highlight_run | logical | True when the rush gained 8 or more yards. |
adj_rush_yardage | integer | Rushing yards capped at 8, the input to the line-yards decomposition. |
line_yards | double | Yards credited to the offensive line on a rush, using the standard sliding scale: 1.2x the capped yardage on a loss, all of it through 3 yards, half of each yard from 4 to 8, and a 5.5-yard ceiling beyond that. |
second_level_yards | double | Rushing yards earned from 4 to 8, split evenly between line and carrier under the line-yards decomposition. |
open_field_yards | integer | Rushing yards gained beyond 8, credited to the ball carrier rather than the line. |
highlight_yards | double | Second-level plus open-field yards -- the yardage credited to the carrier. |
opp_highlight_yards | double | Highlight yards earned on opportunity runs, isolating carrier production on carries where the blocking succeeded. Assets published before the 2026-08 fix are identically 0 here, because the inverted opportunity_run gate could never co-occur with non-zero highlight yards. |
short_rush_success | logical | True when a short-yardage rush gained the yardage needed. |
short_rush_attempt | logical | True when the play is a rush in a short-yardage situation. |
early_down | logical | True when the play is a scrimmage play on first or second down. |
late_down | logical | True when the play is a scrimmage play on third or fourth down. |
power_rush_attempt | logical | True when the play is a short-yardage power rushing attempt. |
power_rush_success | logical | True when a power rushing attempt gained the yardage needed. |
early_down_pass | logical | True when the play is a pass on an early down. |
early_down_rush | logical | True when the play is a rush on an early down. |
late_down_pass | logical | True when the play is a pass on a late down. |
late_down_rush | logical | True when the play is a rush on a late down. |
standard_down | logical | True when the offense is on schedule for the series -- first down, second down needing fewer than 8, or third/fourth down needing fewer than 5. |
passing_down | logical | True when the offense is behind schedule for the series -- second down needing 8 or more, or third/fourth down needing 5 or more. |
TFL | logical | True when the play was a tackle for loss. |
TFL_pass | logical | True when the play was a tackle for loss on a pass play (a sack). |
TFL_rush | logical | True when the play was a tackle for loss on a rush play. |
havoc | logical | True when the defense disrupted the play: a pass breakup, tackle for loss, interception or forced fumble. |
first_down_yards | logical | Whether the play gained enough yardage to earn a first down. |
first_down_penalty | logical | |
first_down_earned | logical | Whether the play earned a first down by means other than yardage (e.g. by penalty). |
start.pos_team_spread | double | ESPN's pos_team_spread value for the play state at the start of the play. |
start.elapsed_share | double | ESPN's elapsed_share value for the play state at the start of the play. |
start.spread_time | double | ESPN's spread_time value for the play state at the start of the play. |
end.pos_team_spread | double | ESPN's pos_team_spread value for the play state at the end of the play. |
end.elapsed_share | double | ESPN's elapsed_share value for the play state at the end of the play. |
end.spread_time | double | ESPN's spread_time value for the play state at the end of the play. |
penalty_assessed_on_kickoff | logical | Whether a penalty was assessed on a kickoff; such plays take the kickoff/touchback win-probability handling. |
start.yardsToEndzone.touchback | integer | ESPN's yardsToEndzone.touchback value for the play state at the start of the play. |
EP_start_touchback | double | Expected points the offense would have had from a touchback on this play. |
EP_start | double | Expected points for the offense at the start of the play. |
EP_end | double | Expected points for the offense at the end of the play. |
EP_penalty_cf | double | Counterfactual expected points for the penalty branch -- the EP had the alternative penalty outcome been taken (null unless a penalty decision existed). |
penalty_cf_yardsToEndzone | integer | Yards to the end zone in the counterfactual penalty branch. |
lag_EP_end | double | Value of EP_end on the previous play, used for sequence-aware derivations. |
EP_between | double | Change in expected points across the play, before penalty adjustment. |
EPA_scrimmage | double | EPA credited to the play on plays from scrimmage. |
EPA_rush | double | EPA credited to the play on rush plays. |
EPA_pass | double | EPA credited to the play on pass plays. |
EPA_explosive | logical | True when the play was explosive. |
EPA_non_explosive | double | EPA credited to the play on non-explosive plays. |
EPA_explosive_pass | logical | True when the pass play was explosive. |
EPA_explosive_rush | logical | True when the rush play was explosive. |
first_down_created | logical | True when the play produced a first down for the offense. |
EPA_success | logical | True when the play was successful by EPA. |
EPA_success_early_down | logical | True when the play on an early down was successful by EPA. |
EPA_success_early_down_pass | logical | True when the pass play on an early down was successful by EPA. |
EPA_success_early_down_rush | logical | True when the rush play on an early down was successful by EPA. |
EPA_success_late_down | logical | True when the play on a late down was successful by EPA. |
EPA_success_late_down_pass | logical | True when the pass play on a late down was successful by EPA. |
EPA_success_late_down_rush | logical | True when the rush play on a late down was successful by EPA. |
EPA_success_standard_down | logical | True when the play on a standard down was successful by EPA. |
EPA_success_passing_down | logical | True when the play on a passing down was successful by EPA. |
EPA_success_pass | logical | True when the pass play was successful by EPA. |
EPA_success_rush | logical | True when the rush play was successful by EPA. |
EPA_success_EPA | double | EPA on successful plays. |
EPA_success_standard_down_EPA | double | EPA on successful plays on a standard down. |
EPA_success_passing_down_EPA | double | EPA on successful plays on a passing down. |
EPA_success_pass_EPA | double | EPA on successful pass plays. |
EPA_success_rush_EPA | double | EPA on successful rush plays. |
EPA_middle_8_success | logical | True when the play in the middle eight was successful by EPA. |
EPA_middle_8_success_pass | logical | True when the pass play in the middle eight was successful by EPA. |
EPA_middle_8_success_rush | logical | True when the rush play in the middle eight was successful by EPA. |
EPA_penalty | double | EPA credited to the play attributable to penalties. |
EPA_penalty_direct | double | EPA attributable directly to the penalty on the play, separated from the EPA of the play itself (observed -11.7 to 8.05; null when no penalty applied). |
EPA_sp | double | EPA credited to the play on special-teams plays. |
EPA_fg | double | EPA credited to the play on field-goal attempts. |
EPA_punt | double | EPA credited to the play on punt plays. |
EPA_kickoff | double | EPA credited to the play on kickoff plays. |
start.ExpScoreDiff_touchback | double | ESPN's ExpScoreDiff_touchback value for the play state at the start of the play. |
start.ExpScoreDiff | double | ESPN's ExpScoreDiff value for the play state at the start of the play. |
start.ExpScoreDiff_Time_Ratio_touchback | double | ESPN's ExpScoreDiff_Time_Ratio_touchback value for the play state at the start of the play. |
start.ExpScoreDiff_Time_Ratio | double | ESPN's ExpScoreDiff_Time_Ratio value for the play state at the start of the play. |
end.ExpScoreDiff | double | ESPN's ExpScoreDiff value for the play state at the end of the play. |
end.ExpScoreDiff_Time_Ratio | double | ESPN's ExpScoreDiff_Time_Ratio value for the play state at the end of the play. |
wp_touchback | double | Win probability the offense would have had starting from a touchback. |
wp_before_naive | double | Pre-snap possession-team win probability from the spread-free (naive) WP model. |
wp_touchback_naive | double | Naive-model win probability for the kickoff-touchback substitute state, used as the pre-snap WP on kickoffs. |
wp_after_naive | double | End-of-play possession-team win probability from the naive model, after the game-logic adjustment chain. |
def_wp_before_naive | double | Pre-snap defense win probability under the naive model (1 - wp_before_naive). |
home_wp_before_naive | double | Pre-snap naive win probability mapped to the home team. |
away_wp_before_naive | double | Pre-snap naive win probability mapped to the away team. |
lead_wp_before_naive | double | Next play's pre-snap naive win probability, used in the end-of-half and change-of-possession adjustments. |
lead_wp_before2_naive | double | Pre-snap naive win probability two plays ahead, used where the immediately following row is a non-play. |
def_wp_after_naive | double | End-of-play defense win probability under the naive model. |
home_wp_after_naive | double | End-of-play naive win probability mapped to the home team. |
away_wp_after_naive | double | End-of-play naive win probability mapped to the away team. |
wpa_naive | double | Win probability added on the play under the spread-free (naive) model. |
cp | double | |
cp_game_state | double | Completion probability from the 8-feature game-state booster, scored on every pass play regardless of which model produced cp. On one scale across seasons, so use it (not cp) for anything summed or averaged; null on non-pass plays. |
cp_model | character | Which completion-probability booster scored cp on the play: "air_yards" (the 11-feature model, used where ESPN's play text gives a catch/target spot -- essentially 2025 onward) or "game_state" (the 8-feature model used everywhere else). The two are not on one scale, so group any cpoe aggregate by this column; null on non-pass plays. |
cpoe | double | |
era | integer | |
xpass | double | |
pass_oe | double | |
drive_start | double | Yard line at which the drive began. |
drive_stopped | logical | True when the play ended the drive. |
drive_play_index | integer | Sequence number of the play within its drive. |
drive_offense_plays | integer | Offensive plays run on the drive. |
prog_drive_EPA | double | Cumulative EPA accrued by the drive up to and including this play. |
prog_drive_WPA | double | Cumulative win-probability added by the drive up to and including this play. |
drive_offense_yards | integer | Offensive yards gained on the drive. |
drive_total_yards | integer | Total yards gained on the drive. |
qbr_epa | double | EPA variant used as an input to the QBR calculation. |
weight | double | Listed weight (lbs). |
non_fumble_sack | logical | True when the play was a sack that did not produce a fumble. |
sack_epa | double | EPA credited to the play when it is a sack. |
pass_epa | double | EPA credited to the play when it is a pass. |
rush_epa | double | EPA credited to the play when it is a rush. |
pen_epa | double | EPA attributable to a penalty on the play. |
sack_weight | double | Weighting applied to the sack component of the play. |
pass_weight | double | Weighting applied to the pass component of the play. |
rush_weight | double | Weighting applied to the rush component of the play. |
pen_weight | double | Weighting applied to the penalty component of the play. |
action_play | logical | True when the play advanced the game state -- excludes timeouts, end-of-period markers and other non-action rows. |
athlete_name | character | Player full name. |
rusher_player_id | integer | |
passer_player_id | integer | |
receiver_player_id | integer | |
fumble_player_id | integer | CFBD athlete_id of the player who fumbled. |
sack_player_id | integer | Comma-separated CFBD athlete_id(s) of the sacking defender(s). |
sack_player_id2 | integer | ESPN athlete id of the second sacker on a split sack (regex fallback for an ESPN sidecar blind spot). |
interception_player_id | integer | CFBD athlete_id of the defender credited with an interception. |
pass_breakup_player_id | integer | CFBD athlete_id of the defender credited with the pass breakup (PBU). |
fumble_forced_player_id | integer | CFBD athlete_id of the defender credited with forcing the fumble. |
fumble_recovered_player_id | integer | CFBD athlete_id of the player recovering the fumble. |
fg_kicker_player_id | integer | ESPN athlete id of the field-goal kicker. |
punter_player_id | integer | |
kickoff_player_id | integer | ESPN athlete id of the player kicking off. |
kickoff_return_player_id | integer | ESPN athlete id of the kickoff returner. |
punt_return_player_id | integer | ESPN athlete id of the punt returner. |
fg_block_player_id | integer | ESPN athlete id of the player who blocked the field goal. |
punt_block_player_id | character | ESPN athlete id of the player who blocked the punt. |
fg_return_player_id | character | ESPN athlete id of the player who returned the blocked or missed field goal. |
punt_block_return_player_id | character | ESPN athlete id of the player who returned the blocked punt. |
go_wp | double | Win probability from going for it on fourth down: conversion-probability-weighted mean of the success and failure states (cfb4th port). |
first_down_prob | double | Modeled probability of converting the fourth down when going for it. |
wp_succeed | double | Mean win probability across yardage outcomes given the fourth-down attempt converts. |
wp_fail | double | Mean win probability given the fourth-down attempt fails. |
make_fg_wp | double | Win probability given the field-goal attempt is made. |
miss_fg_wp | double | Win probability given the field-goal attempt misses. |
fg_wp | double | Make-probability-weighted win probability of attempting the field goal. |
punt_wp | double | Win probability of punting, from the bundled punt-outcome distribution. |
go_boost | double | cfb4th's headline number: 100 * (go_wp - max(fg_wp, punt_wp)), in percentage points. |
go_wp_diff | double | go_wp minus the recommended option's WP (0 when going for it is the recommendation, otherwise <= 0). |
fg_wp_diff | double | fg_wp minus the recommended option's WP (0 when the field goal is the recommendation, otherwise <= 0). |
punt_wp_diff | double | punt_wp minus the recommended option's WP (0 when punting is the recommendation, otherwise <= 0). |
fourth_down_recommendation | character | Max-WP fourth-down choice among "go", "punt", and "field_goal". |
two_pt_wp | double | Win probability of going for two: conversion-probability-weighted mean of the 2-point and 0-point outcomes (cfb4th port). |
xp_wp | double | Win probability of kicking the extra point, weighting the make by the empirical CFB extra-point make rate. |
prob_2pt | double | Two-point conversion probability from the bundled CFB two-point model. |
two_pt_recommendation | character | Point-after recommendation: "go_for_2" when two_pt_wp exceeds xp_wp, otherwise "kick_xp". |
two_pt_wp_diff | double | two_pt_wp minus xp_wp; positive favors going for two. |
play_type_canonical | character | |
play_type_family | character |
Example
import polars as pl
from sportsdataverse.cfb import add_play_type_canonical
pbp = pl.DataFrame({"type.text": ["Rush", "Pass Reception", "Timeout"]})
out = add_play_type_canonical(pbp)
out.group_by("play_type_family").agg(pl.len())
canonical_play_type_expr
canonical_play_type_expr(source: 'str' = 'type.text') -> 'pl.Expr'
Build the polars expression mapping raw type.text to a canonical type.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
source | str | 'type.text' | Name of the raw play-type column. |
Returns
A pl.Expr aliased play_type_canonical. Values absent from PLAY_TYPE_CANONICAL (and nulls) yield null, so upstream vocabulary drift surfaces rather than silently creating a category.
Example
import polars as pl
from sportsdataverse.cfb import canonical_play_type_expr
pbp = pl.DataFrame({"type.text": ["Pass Reception", "Punt Return"]})
pbp.with_columns(canonical_play_type_expr())
cfb_adjusted_tempo
cfb_adjusted_tempo(seasons: 'Union[int, list[int]]', *, exclude_garbage: 'bool' = True, config: 'Optional[AdjustConfig]' = None, return_as_pandas: 'bool' = False) -> 'Union[pl.DataFrame, pd.DataFrame]'
Team-season situation-neutral, opponent-adjusted tempo / pace.
Counts scrimmage plays per team-game (garbage time and kneels/spikes
dropped) and per-play elapsed seconds, then opponent-adjusts both with
the iterative solver on the per-game values (a fast team facing slow
defenses gets adj_plays_game > raw_plays_game).
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
seasons | Union[int, list[int]] | season or list of seasons (hosted pbp covers 2002-2021). | |
exclude_garbage | bool | True | drop Connelly garbage-time plays. |
config | Optional[AdjustConfig] | None | AdjustConfig for the solver. |
return_as_pandas | bool | False | return a pandas DataFrame instead of polars. |
Returns
One row per (season, team_id): games, raw_plays_game, adj_plays_game, raw_sec_play, adj_sec_play, pace_rank (rank 1 = fastest adjusted pace). Zero-row frame with the documented schema on empty input.
| col_name | type | description |
|---|---|---|
season | integer | Season the pace covers. |
team_id | character | Team ESPN id (character join key). |
games | integer | Games with situation-neutral offensive snaps in the loaded seasons. |
raw_plays_game | double | Situation-neutral scrimmage plays per game (garbage time and kneels/spikes excluded). |
adj_plays_game | double | Opponent-adjusted situation-neutral plays per game (iterative solver; higher = faster). |
raw_sec_play | double | Mean seconds elapsed per situation-neutral play (season total seconds over total plays). |
adj_sec_play | double | Opponent-adjusted seconds elapsed per situation-neutral play (lower = faster). |
pace_rank | integer | Dense rank on adj_plays_game descending (fastest adjusted pace = 1). |
Example
from sportsdataverse.cfb import cfb_adjusted_tempo
df = cfb_adjusted_tempo([2021])
print(df.shape)
# Pipeline next step (one line)
df.sort("pace_rank").head()
cfb_games_from_schedule
cfb_games_from_schedule(schedule: 'FrameLike', *, return_as_pandas: 'bool' = False) -> 'Union[pl.DataFrame, Any]'
Map a load_cfb_schedule() frame into the seedr engine games schema.
Derives game_type heuristically: games whose notes mention a
championship (but not the CFP / national championship) are
CONF_CHAMP; otherwise season_type == "regular" maps to REG
and everything else to POST. result is the home margin
(home_points - away_points; null when either score is missing) and
neutral comes from neutral_site.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
schedule | FrameLike | Output of sportsdataverse.cfb.load_cfb_schedule (needs season, week, season_type, home_team, away_team, home_points, away_points, neutral_site and optionally notes). | |
return_as_pandas | bool | False | Return a pandas DataFrame instead of polars. |
Returns
A polars (or pandas) DataFrame with columns season, week, game_type, home_team, away_team, result, neutral, home_points, away_points — the cfb_standings / cfb_simulations input schema. The trailing per-game points columns feed the SEC capped_scoring_margin official tiebreaker rung (see CONFERENCE_TIEBREAKERS); cfb_standings skips that rung when they're absent, so passing this frame straight through is always safe.
| col_name | type | description |
|---|---|---|
season | integer | Season the game belongs to; consumed as the sim/season identifier by cfb_standings and cfb_simulations. |
week | integer | Week of the season the game is scheduled in, passed through from the schedule frame. |
game_type | character | Derived game classification - CONF_CHAMP when the schedule notes mention a (non-CFP, non-national) championship, REG for regular-season rows, POST otherwise. |
home_team | character | Team name of the home team, passed through from the schedule frame. |
away_team | character | Team name of the away team, passed through from the schedule frame. |
result | double | Home-team margin (home_points minus away_points); null when either score is missing, marking the game as unplayed for the simulation engine. |
neutral | integer | Neutral-site flag derived from the schedule's neutral_site column (1 = neutral site, 0 = home game). |
home_points | double | Home team's final score, passed through from the schedule frame; null when missing (unplayed game). Feeds the SEC capped_scoring_margin official conference tiebreaker rung in cfb_standings - the rung is skipped when absent. |
away_points | double | Away team's final score, passed through from the schedule frame; null when missing (unplayed game). Feeds the SEC capped_scoring_margin official conference tiebreaker rung in cfb_standings - the rung is skipped when absent. |
Example
import polars as pl
from sportsdataverse.cfb import (
load_cfb_schedule, cfb_games_from_schedule, cfb_standings,
)
sched = load_cfb_schedule(seasons=2024)
games = cfb_games_from_schedule(sched)
teams = (
sched.select(team=pl.col("home_team"), conference=pl.col("home_conference"))
.vstack(sched.select(team=pl.col("away_team"), conference=pl.col("away_conference")))
.unique(subset=["team"], keep="first")
)
st = cfb_standings(games, teams)
print(st.head())
cfb_playoff_seeds
cfb_playoff_seeds(standings: 'FrameLike', rankings: 'Optional[FrameLike]' = None, playoff_seeds: 'int' = 12, *, return_as_pandas: 'bool' = False) -> 'Union[pl.DataFrame, Any]'
Assign College Football Playoff seeds (current straight-seeding rule).
Implements the 2025 CFP rule: the field is the playoff_seeds (12)
best-ranked teams with the 5 highest-ranked conference champions
guaranteed inclusion; seeds are assigned straight by ranking order (no
champion bump to the top four). The rule evolves — it lives in this ONE
function so it can be updated in one place.
When rankings is None the ordering falls back to the standings
tiebreaker metrics — win_pct desc, then sov, sos, pd
desc, then team name (documented deterministic fallback; a committee
ranking is the intended input).
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
standings | FrameLike | Output of cfb_standings (needs sim, team, conf_champ, win_pct, sov, sos, pd). | |
rankings | Optional[FrameLike] | None | Optional frame with columns team and rank (1 = best). Unranked teams order after ranked ones by the fallback. |
playoff_seeds | int | 12 | Field size (default 12). The champion guarantee is min(5, number of champions, playoff_seeds). |
return_as_pandas | bool | False | Return a pandas DataFrame instead of polars. |
Returns
The standings frame with a seed column (Int64; null for teams outside the field), sorted by sim and seed.
| col_name | type | description |
|---|---|---|
sim | integer | Season or simulation identifier the standings row belongs to. |
team | character | Team name (join key across the seedr engine frames). |
conference | character | Conference the team belongs to; null or "FBS Independents" marks an independent. |
games | integer | Total games played across all game types (regular season, conference championship and postseason). |
wins | integer | Wins across all played games (conference championship and postseason included). |
losses | integer | Losses across all played games. |
ties | integer | Ties across all played games. |
win_pct | double | Overall win percentage - (wins + 0.5 * ties) / games, 0.0 when no games have been played. |
pd | double | Point differential (points for minus points against, via game margins) summed over all played games. |
conf_games | integer | Number of conference regular-season games played (both teams in the same conference; CONF_CHAMP games excluded). |
conf_wins | integer | Wins in conference regular-season games. |
conf_losses | integer | Losses in conference regular-season games. |
conf_ties | integer | Ties in conference regular-season games. |
conf_pct | double | Conference win percentage - (conf_wins + 0.5 * conf_ties) / conf_games, 0.0 with no conference games; the primary sort key for conference ranks. |
conf_pd | double | Point differential summed over conference regular-season games only; the POINTS-depth tiebreaker rung. |
sov | double | Strength of victory, conference-REG-scoped (unlike nflseedR's overall games-weighted version) - mean of defeated conference opponents' conference win pct, one term per conference victory; 0.0 for independents or teams without conference wins. |
sos | double | Strength of schedule, conference-REG-scoped (unlike nflseedR's overall games-weighted version) - mean of conference opponents' conference win pct across all conference games played; 0.0 for independents. |
conf_rank | integer | Rank within the conference from the tiebreaker cascade (1 = best); null for independents. |
conf_champ | logical | Whether the team is its conference's champion - the CONF_CHAMP game winner when one was played, otherwise the conference's rank-1 team; always false for independents. |
seed | integer | College Football Playoff seed under the straight-seeding rule (1 = best); null for teams outside the field. The five best-ordered conference champions are guaranteed inclusion. |
Example
from sportsdataverse.cfb import cfb_standings, cfb_playoff_seeds
st = cfb_standings(games, teams)
seeded = cfb_playoff_seeds(st, rankings=ranks_df, playoff_seeds=12)
print(seeded.filter(pl.col("seed").is_not_null()))
cfb_resume
cfb_resume(seasons: 'int | list[int]', *, as_of_date: 'datetime.date | None' = None, era: 'str' = 'modern', return_as_pandas: 'bool' = False) -> 'pl.DataFrame | pd.DataFrame'
Rating-based résumé metrics: SoS, quality wins, game control, wins-above-bubble.
For each team, joins every played opponent to its cfb_ratings.cfb_ratings
strength and rolls the games up into:
sos-- mean opponentadj_netover played games (rating-based strength of schedule; complements the record-based SOV/SOS incfb_standings).quality_wins-- count of wins over opponents withadj_netat or above the eraquality_win_threshold.game_control-- mean postgame win expectancyPhi(actual_margin / margin_sd), i.e. how dominant the results were, not just win/loss.wab-- wins above bubble: actual wins minus the expected wins of a bubble-quality team (bubble_adj_net) playing the same schedule, using the Phase-2 predictors with the HFA applied on the team's actual home/away side.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
seasons | int | list[int] | A single season or list of seasons. | |
as_of_date | date | None | None | Leakage boundary forwarded to cfb_ratings.cfb_ratings (ratings use only games before this date). None uses the full season. |
era | str | 'modern' | Era key into cfb_prediction_constants.CFB_CONSTANTS. |
return_as_pandas | bool | False | If True, return a pandas DataFrame; otherwise polars. |
Returns
One row per team: season, team_id (Utf8), sos, sos_rank (Int64 dense rank, best = 1), quality_wins (Int64), game_control (Float64), wab (Float64). Zero-row (typed) when no games are available.
| col_name | type | description |
|---|---|---|
season | integer | Season the résumé covers (null for a pooled multi-season fit). |
team_id | character | Team ESPN id (character join key). |
sos | double | Rating-based strength of schedule - mean opponent adj_net over played games. |
sos_rank | integer | Dense rank on sos descending (toughest schedule = 1). |
quality_wins | integer | Count of wins over opponents with adj_net at or above the era quality-win threshold. |
game_control | double | Mean postgame win expectancy Phi(actual_margin / margin_sd) across played games - how dominant the results were, not just win/loss. |
wab | double | Wins above bubble - actual wins minus a bubble-quality team's expected wins over the same schedule. |
Example
from sportsdataverse.cfb.cfb_resume import cfb_resume
resume = cfb_resume(2023)
resume.sort("sos_rank").head()
cfb_returning_production
cfb_returning_production(seasons: 'int | list[int]', *, division: 'str' = 'fbs', return_as_pandas: 'bool' = False) -> 'pl.DataFrame | pd.DataFrame'
Returning production per team-season (offense / defense / overall).
For each requested season S, computes the fraction of season S-1 unit
production attributable to players on the season-S roster (Bill Connelly's
returning-production concept; unit weights from get_constants).
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
seasons | int | list[int] | Target season or list of seasons (production is drawn from S-1). | |
division | str | 'fbs' | Division slug for constants lookups. |
return_as_pandas | bool | False | If True, return a pandas DataFrame; otherwise polars. |
Returns
Per (season, team_id): off_returning, def_returning, overall_returning (Float64 fractions in [0, 1]), n_returning (Int64 count of returning contributors), def_basis, overall_basis (Utf8, below), is_estimated (Boolean). team_id is the ESPN team id as Utf8 -- BREAKING vs the previous release, which emitted a normalized team NAME under team and joined at 57.7%. Zero-row (typed) when the box data is unavailable. is_estimated is True for 2004 only, where season-2003 production is parsed from CFBD play text because ESPN's player box starts in 2004. Back-tested on 2005, where both sources exist, that route tracks the box route at r=0.73 (MAE 0.11) but reads about 0.085 LOW. It ranks teams well; it is not on the same level as its neighbours, so filter on this flag before comparing 2004 against another season. 2004 also carries a null def_returning -- 2003 play text has no defensive ids. def_basis names the defensive measure: "participants" when the production season is 2014+ (tackles, assists, tackles for loss, shared sacks, passes defended -- 92-100% of teams), "pbp_splash" for 2004-2013 (sacks, interceptions, pass breakups, forced fumbles; no tackle volume, so not on the same scale), "box" when that source's release is missing, null with def_returning. overall_basis is "offense+defense", or "offense" for a team with no defensive value, whose overall then equals off_returning.
| col_name | type | description |
|---|---|---|
season | integer | Season the returning fractions describe (production drawn from the prior season). |
team_id | character | ESPN team id as a string (integer-origin). |
off_returning | double | Fraction of prior-season attributed offensive yardage (passing + rushing + receiving) returning on the current roster. |
def_returning | double | Fraction of prior-season weighted defensive production returning on the current roster; the measure is named in def_basis. |
overall_returning | double | Unit fractions combined with the fitted returning_prod_weights (FBS offense 0.49 / defense 0.51, the 2018-2025 fit in fit_returning_weights.py). |
n_returning | integer | Count of prior-season contributors present on the current roster. |
def_basis | character | Defensive measure behind def_returning: participants (production season 2014+: tackles, assists, tackles for loss, shared sacks, passes defended), pbp_splash (2004-2013: sacks, interceptions, pass breakups, forced fumbles; no tackle volume, so not on the same scale), box (the source release was missing), or null with def_returning. |
overall_basis | character | Units in overall_returning: offense+defense, or offense for a team with no defensive value, whose overall then equals off_returning. |
is_estimated | logical | True for 2004 only, where season-2003 production is parsed from play text; it reads about 0.085 low against the box route. |
Example
from sportsdataverse.cfb import cfb_returning_production
rp = cfb_returning_production(2023)
rp.sort("overall_returning", descending=True).head(10)