Skip to main content

NFL — additional Python functions — Nfl: ngs–season

nfl_ngs_play_is_highlight​

nfl_ngs_play_is_highlight(game_id, play_id, return_as_pandas: 'bool' = False)

Look up whether a single play is an NGS highlight -- one-row frame.

Wraps /api/plays/isHighlight (keyed by NGS gameId + playId). When the play is a highlight, the response's nested highlight block (the play metadata, the players involved, season/week/team) is flattened onto the row alongside the top-level gameId/playId/isHighlight flag. Pull a real (gameId, playId) pair from nfl_ngs_leaders -- each leader entry's play_gameId / play_playId is a known highlight.

Parameters

ParameterTypeDefaultDescription
game_idNGS gameId (e.g. "2024111800").
play_idthe play id within that game (e.g. 1214).
return_as_pandasboolFalsereturn a pandas frame instead of polars.

Returns

A one-row polars (or pandas) DataFrame with gameId, playId, isHighlight and (when true) flattened highlight_* columns.

col_nametypedescription
gameIdintegerNFL Shield API game identifier for the game this highlight record belongs to.
playIdintegerUnique play event identifier (UUID).
isHighlightlogicalBoolean flag indicating whether this play record has been designated as a highlight by the NFL Shield API.
highlight_gameIdintegerNFL Shield API game identifier associated with the specific highlight clip.
highlight_playIdintegerNFL Shield API play identifier for the specific play associated with the highlight clip.
highlight_play_playTypecharacterText label for the type of play (e.g., 'PASS', 'RUSH', 'PUNT') as classified by the NFL Shield API.
highlight_play_gameIdintegerNFL Shield API game identifier embedded in the play detail record for the highlight.
highlight_play_gameKeyintegerNFL Shield internal game key integer used to identify the game in internal API routing.
highlight_play_yardlineSidecharacterTeam abbreviation indicating which team's side of the field the yardline is on.
highlight_play_absoluteYardlineNumberintegerAbsolute yard line number (1–100 from one end zone) of the line of scrimmage at the snap for the highlighted play.
highlight_play_yardlineNumberintegerNumeric yard line (1–50 from nearest end zone) of the line of scrimmage at the snap.
highlight_play_timeOfDayUTCcharacterWall-clock timestamp in UTC at which the highlighted play occurred during the broadcast.
highlight_play_isPenaltylogicalBoolean flag indicating whether a penalty was assessed on the highlighted play.
highlight_play_homeScoreintegerHome team's score at the end of the highlighted play.
highlight_play_visitorScoreintegerVisiting team's score at the end of the highlighted play.
highlight_play_playStatsintegerSerialized or encoded statistical detail associated with the play outcomes (e.g., yards, player ids).
highlight_play_playIdintegerNFL Shield API unique integer identifier for the specific play within the game.
highlight_play_playDescriptioncharacterOfficial NFL text description of the highlighted play (e.g., '(12:34) T.Brady pass short right to J.Edelman for 8 yards').
highlight_play_playTypeCodeintegerInteger code corresponding to the play type classification in the NFL Shield API.
highlight_play_quarterintegerQuarter number (1–4, or 5 for overtime) during which the highlighted play occurred.
highlight_play_downintegerDown number (1–4) at the time of the highlighted play.
highlight_play_yardsToGointegerInteger yards needed for a first down on the highlighted play.
highlight_play_actualYardsToGodoubleExact decimal yards required for a first down on the highlighted play.
highlight_play_actualYardlineForFirstDowndoubleActual yard line marker needed for a first down on the highlighted play.
highlight_play_possessionTeamIdcharacterNFL Shield team identifier for the team that had possession during the highlighted play.
highlight_play_isGoalToGologicalBoolean flag indicating whether the highlighted play occurred in a goal-to-go situation.
highlight_play_healthcharacterData quality or tracking health status string indicating the reliability of player/ball tracking data for this play.
highlight_play_endGameClockcharacterGame clock time remaining at the end of the highlighted play in MM:SS format.
highlight_play_startGameClockcharacterGame clock time remaining at the start of the highlighted play in MM:SS format.
highlight_play_playStatecharacterState or status of the play record (e.g., 'FINAL', 'LIVE') in the NFL Shield API at time of capture.
highlight_play_preSnapHomeScoreintegerHome team's score immediately before the snap of the highlighted play.
highlight_play_preSnapVisitorScoreintegerVisitor team's score immediately before the snap of the highlighted play.
highlight_play_sequenceintegerSequential order integer of this play within the game, as used by the NFL Shield API.
highlight_play_gameClockcharacterGame clock time remaining at the start of the highlighted play in MM:SS format.
highlight_play_yardlinecharacterHuman-readable yardline string (e.g., 'KC 35') indicating where the play began.
highlight_play_isScoringlogicalBoolean flag indicating whether the highlighted play resulted in a score.
highlight_play_isEndQuarterlogicalBoolean flag indicating whether the highlighted play was the final play of a quarter.
highlight_play_isSTPlaylogicalBoolean flag indicating whether the highlighted play was a special teams play.
highlight_play_playDirectioncharacterDirection of the play (left, right, middle) as recorded in the NFL Shield tracking data.
highlight_play_isBigPlaylogicalBoolean flag indicating whether the play was classified as a 'big play' (e.g., long gain or turnover) by the NFL Shield API.
highlight_play_isChangeOfPossessionlogicalBoolean flag indicating whether the highlighted play resulted in a change of possession.
highlight_playersintegerSerialized list or count of player tracking records associated with the highlight clip.
highlight_seasonintegerNFL season year (e.g., 2024) in which the highlighted play occurred.
highlight_seasonTypecharacterSeason phase of the highlighted play (e.g., 'REG' for regular season, 'POST' for playoffs).
highlight_teamAbbrcharacterTeam abbreviation of the team featured in or associated with the highlight clip.
highlight_teamIdcharacterNFL Shield team identifier for the team featured in the highlight clip.
highlight_weekintegerWeek number within the season during which the highlighted play occurred.

Example

from sportsdataverse.nfl import nfl_ngs_leaders, nfl_ngs_play_is_highlight
lead = nfl_ngs_leaders(category="speed", season=2024, season_type="REG")
gid, pid = lead["play_gameId"][0], lead["play_playId"][0]
hl = nfl_ngs_play_is_highlight(game_id=gid, play_id=pid)
hl.select(["gameId", "playId", "isHighlight"]).head()

nfl_ngs_ryoe​

nfl_ngs_ryoe(seasons: 'Union[int, Sequence[int]]', *, min_attempts: 'int' = 20, return_as_pandas: 'bool' = False, _loader: 'Optional[Callable[..., pl.DataFrame]]' = None) -> 'Union[pl.DataFrame, pd.DataFrame]'

Rush yards over expected per rusher-season, stabilised with EB shrinkage.

ryoe_per_att_raw is the NGS-shipped rush_yards_over_expected_per_att passed through unchanged (the NGS tracking-model residual); ryoe_total is the season total rush_yards_over_expected. ryoe_per_att_shrunk applies per-season Efron-Morris empirical-Bayes shrinkage toward the attempt-weighted league mean, weighted by rush_attempts. pct_stacked_box (percent_attempts_gte_eight_defenders) is reported as a context covariate — v1 does not adjust on it. The prior is fit at call time on rows with rush_attempts >= min_attempts — no bundled artifact.

Parameters

ParameterTypeDefaultDescription
seasonsUnion[int, Sequence[int]]Season(s) to compute, 2016+.
min_attemptsint20Qualification threshold for the prior fit and for receiving a ryoe_rank. Defaults to sportsdataverse.nfl.nfl_ngs_constants.MIN_ATTEMPTS.
return_as_pandasboolFalseIf True, returns a pandas DataFrame.
_loaderOptional[Callable]NoneInjectable loader for offline tests.

Returns

One row per (season, player_gsis_id) with raw + shrunk RYOE/attempt, reliability in [0, 1], and a dense descending ryoe_rank over qualified rows (null for unqualified rows). Empty input returns a zero-row frame with the documented schema.

col_nametypedescription
seasonintegerNFL season (YYYY).
player_gsis_idcharacterPlayer GSIS identifier (nflverse id, e.g. "00-0036223"), pinned Utf8.
player_display_namecharacterPlayer display name as shipped by NGS.
team_abbrcharacterTeam abbreviation.
positioncharacterPlayer position (from NGS player_position).
rush_attemptsdoubleSeason rush attempts — the shrinkage weight.
rush_yardsdoubleSeason rushing yards.
expected_rush_yardsdoubleNGS tracking-model expected rushing yards for the season.
ryoe_totaldoubleSeason rush yards over expected (NGS rush_yards_over_expected, passed through).
ryoe_per_att_rawdoubleNGS rush_yards_over_expected_per_att passed through unchanged — the tracking-model residual per attempt.
ryoe_per_att_shrunkdoubleryoe_per_att_raw after per-season empirical-Bayes shrinkage toward the attempt-weighted league mean (sampling variance identified from weekly rows).
pct_stacked_boxdoublePercent of attempts against 8+ defenders in the box (NGS percent_attempts_gte_eight_defenders) — reported as a context covariate, not adjusted on.
reliabilitydoubleShrinkage reliability tau2 / (tau2 + sigma2 / rush_attempts) in [0, 1]; the fraction of the raw deviation retained.
ryoe_rankintegerDense descending rank of ryoe_per_att_shrunk within season over qualified rows; null when rush_attempts < min_attempts.

Example

from sportsdataverse.nfl import nfl_ngs_ryoe
df = nfl_ngs_ryoe([2023])
print(df.sort("ryoe_rank").head())

# Pandas output

df_pd = nfl_ngs_ryoe(2023, return_as_pandas=True)

nfl_ngs_separation_oe​

nfl_ngs_separation_oe(seasons: 'Union[int, Sequence[int]]', *, min_targets: 'int' = 20, return_as_pandas: 'bool' = False, _loader: 'Optional[Callable[..., pl.DataFrame]]' = None) -> 'Union[pl.DataFrame, pd.DataFrame]'

Separation over a built context expectation, per receiver-season.

Unlike YAC-OE and RYOE, NGS ships no expected-separation field, so this model BUILDS one: a per-season weighted ridge (sportsdataverse.nfl.nfl_ngs_constants.expected_separation_ridge) of avg_separation on avg_cushion, avg_intended_air_yards and a position one-hot, weighted by targets. sep_oe_raw is the residual — a CONTEXT residual (role/scheme proxies), not a tracking-model expectation; treat it as descriptive, not causal. sep_oe_shrunk applies the same per-season empirical-Bayes shrinkage as the sibling models, weighted by targets. All parameters are fit from the requested seasons at call time — no bundled artifact.

Parameters

ParameterTypeDefaultDescription
seasonsUnion[int, Sequence[int]]Season(s) to compute, 2016+.
min_targetsint20Qualification threshold for the shrinkage prior and for receiving a sep_oe_rank. Defaults to sportsdataverse.nfl.nfl_ngs_constants.MIN_TARGETS.
return_as_pandasboolFalseIf True, returns a pandas DataFrame.
_loaderOptional[Callable]NoneInjectable loader for offline tests.

Returns

One row per (season, player_gsis_id) with the built expected_separation, raw + shrunk separation-over-expected, reliability in [0, 1], and a dense descending sep_oe_rank over qualified rows. Rows with null separation/cushion/air-yards inputs are dropped before the fit. Empty input returns a zero-row frame with the documented schema.

col_nametypedescription
seasonintegerNFL season (YYYY).
player_gsis_idcharacterPlayer GSIS identifier (nflverse id, e.g. "00-0036223"), pinned Utf8.
player_display_namecharacterPlayer display name as shipped by NGS.
team_abbrcharacterTeam abbreviation.
positioncharacterPlayer position (from NGS player_position); one-hot feature in the expectation ridge.
targetsdoubleSeason target count — the ridge weight and the shrinkage weight.
avg_cushiondoubleAverage defender cushion at snap, yards (ridge feature).
avg_separationdoubleAverage separation from the nearest defender at catch/incompletion, yards.
avg_intended_air_yardsdoubleAverage intended air yards on targets (ridge feature).
expected_separationdoubleBuilt per-season weighted-ridge expectation of avg_separation from cushion, intended air yards and position — a CONTEXT expectation, not a tracking model.
sep_oe_rawdoubleavg_separation minus expected_separation (context residual).
sep_oe_shrunkdoublesep_oe_raw after per-season empirical-Bayes shrinkage toward the target-weighted league mean (sampling variance identified from weekly rows).
reliabilitydoubleShrinkage reliability tau2 / (tau2 + sigma2 / targets) in [0, 1]; the fraction of the raw deviation retained.
sep_oe_rankintegerDense descending rank of sep_oe_shrunk within season over qualified rows; null when targets < min_targets.

Example

from sportsdataverse.nfl import nfl_ngs_separation_oe
df = nfl_ngs_separation_oe([2023])
print(df.sort("sep_oe_rank").head())

# Pandas output

df_pd = nfl_ngs_separation_oe(2023, return_as_pandas=True)

nfl_ngs_statboard​

nfl_ngs_statboard(stat_type: 'str' = 'passing', season: 'int' = 2024, season_type: 'str' = 'REG', week: 'Optional[int]' = None, return_as_pandas: 'bool' = False)

NGS season/week statboard leaderboard for a stat family (one row per player).

Wraps /api/statboard/{passing,receiving,rushing}. Each record is a flat per-player stat line (e.g. for passing: completionPercentageAboveExpectation, avgTimeToThrow, aggressiveness, passerRating ...). The player's bio is nested under a player object and is flattened to player_* columns.

Parameters

ParameterTypeDefaultDescription
stat_typestr'passing'one of "passing", "receiving", "rushing". (For the cross-stat highlight board use nfl_ngs_statboard_leaders.)
seasonint2024season year, e.g. 2024.
season_typestr'REG'"REG", "POST", or "PRE".
weekint | NoneNonesingle week to filter to; None returns the full-season board.
return_as_pandasboolFalsereturn a pandas frame instead of polars.

Returns

A polars (or pandas) DataFrame, one row per qualifying player.

col_nametypedescription
aggressivenessdoubleAggressiveness tracks the amount of passing attempts a quarterback makes that are into tight coverage, where there is a defender within 1 yard or less of the receiver at the time of completion or incompletion. AGG is shown as a % of attempts into tight windows over all passing attempts.
attemptsintegerThe number of pass attempts as defined by the NFL.
avgAirDistancedoubleAverage air distance in yards on all pass attempts, measuring how far the ball travels through the air regardless of direction.
avgAirYardsDifferentialdoubleAverage difference between intended air yards and completed air yards, measuring accuracy relative to target depth.
avgAirYardsToSticksdoubleAverage air yards relative to the first-down marker on pass attempts, where positive values indicate throws beyond the sticks.
avgCompletedAirYardsdoubleAverage air yards on completed passes only, measuring depth of actual completions.
avgIntendedAirYardsdoubleAverage depth of target on all pass attempts, regardless of completion.
avgTimeToThrowdoubleAverage time in seconds from snap to release for the passer, as tracked by NFL Next Gen Stats.
completionPercentagedoubleActual completion percentage for the passer during the period covered.
completionPercentageAboveExpectationdoubleCompletion percentage above the model-expected completion rate (CPAE), measuring accuracy relative to difficulty of throws attempted.
completionsintegerThe number of completed passes.
expectedCompletionPercentagedoubleModel-expected completion percentage based on factors such as target depth, separation, and defensive coverage as calculated by NFL Next Gen Stats.
gamesPlayedintegerNumber of games played by the passer during the period covered.
interceptionsintegerThe number of interceptions thrown.
maxAirDistancedoubleMaximum air distance in yards recorded on any single pass attempt during the period covered.
maxCompletedAirDistancedoubleMaximum air distance in yards recorded on any single completed pass during the period covered.
passTouchdownsintegerTotal passing touchdowns thrown by the passer during the period covered.
passYardsintegerTotal passing yards accumulated by the passer during the period covered.
passerRatingdoubleNFL passer rating (0–158.3 scale) for the passer during the period covered.
playerNamecharacterDisplay name of the passer as returned at the top-level statboard row.
seasoninteger4 digit number indicating to which season(s) the specified timeframe belongs to.
seasonTypecharacterSeason segment covered by this statboard record (e.g., 'REG' for regular season, 'POST' for playoffs).
positioncharacterPrimary position as reported by NFL.com
teamIdcharacterNFL Next Gen Stats team identifier for the passer's team at the time of this record.
player_seasonintegerNFL season year associated with this player's statboard record.
player_currentTeamIdcharacterNFL Next Gen Stats team identifier for the team the player is currently rostered on.
player_displayNamecharacterFull display name of the player as used in NFL Next Gen Stats records.
player_esbIdcharacterESPN-Elias Sports Bureau (ESB) identifier for the player.
player_firstNamecharacterFirst name of the player.
player_footballNamecharacterFootball name used by the player, which may differ from the legal first name.
player_gsisIdcharacterNFL GSIS (Game Statistics and Information System) identifier, the primary nflverse player key.
player_gsisItIdintegerNFL GSIS internal tracking integer identifier for the player.
player_headshotcharacterURL to the player headshot image.
player_jerseyNumberintegerJersey number worn by the player.
player_lastNamecharacterLast name of the player.
player_positioncharacterPosition of the player accordinng to NGS
player_positionGroupcharacterBroad position group for the player (e.g., 'QB', 'WR') in the NGS player record.
player_shortNamecharacterShortened display name for the player (e.g., 'P.Mahomes').
player_smartIdcharacterNFL Next Gen Stats smart (UUID-style) identifier for the player.
player_statuscharacterCurrent roster status of the player (e.g., 'ACT' for active, 'IR' for injured reserve).
player_uniformNumbercharacterUniform number worn by the player, stored as a string to preserve leading zeros if applicable.
player_ngsPositioncharacterPlayer's position as classified by the NFL Next Gen Stats system.
player_ngsPositionGroupcharacterBroader position group the player belongs to as classified by the NFL Next Gen Stats system.

Example

from sportsdataverse.nfl import nfl_ngs_statboard
qb = nfl_ngs_statboard(stat_type="passing", season=2024, season_type="REG")
qb.select(["playerName", "passerRating", "completionPercentageAboveExpectation"]).head()

nfl_ngs_statboard_leaders​

nfl_ngs_statboard_leaders(season: 'int' = 2024, season_type: 'str' = 'REG', week: 'Optional[int]' = None, return_as_pandas: 'bool' = False)

NGS cross-stat "leaders" board, stacked long with a category column.

Wraps /api/statboard/leaders, which bundles several short top-N lists of mixed shape (fastestBallCarriers, fastestSacks, longestCompletions, highestSeparation, rushYardsOverExpected, completionPctAboveExpected, avgYACAboveExpected). Each list is normalized separately and concatenated diagonally (union of columns; missing cells become null), with a category column recording which board each row came from.

Parameters

ParameterTypeDefaultDescription
seasonint2024season year.
season_typestr'REG'"REG", "POST", or "PRE".
weekint | NoneNoneoptional single-week filter.
return_as_pandasboolFalsereturn a pandas frame instead of polars.

Returns

A polars (or pandas) DataFrame stacking every leader list, with a category column. Empty frame if no lists are present.

col_nametypedescription
categorycharacterBroader category of player positions
leader_esbIdcharacterESB (NFL's Enterprise Subscriber Base) identifier for the player featured in the leader record.
leader_firstNamecharacterFirst name of the player featured in the leader record.
leader_gsisIdcharacterGSIS (Game Statistics and Information System) identifier for the player featured in the leader record.
leader_jerseyNumberintegerJersey number of the player featured in the leader record.
leader_lastNamecharacterLast name of the player featured in the leader record.
leader_playerNamecharacterFull display name of the player featured in the leader record.
leader_positioncharacterPosition designation of the player featured in the leader record (e.g., 'QB', 'WR').
leader_positionGroupcharacterBroad position group of the player featured in the leader record (e.g., 'OFFENSE', 'DEFENSE').
leader_shortNamecharacterAbbreviated display name of the player featured in the leader record (e.g., 'P.Mahomes').
leader_teamAbbrcharacterTeam abbreviation of the player featured in the leader record (e.g., 'KC').
leader_teamIdcharacterNFL Shield team identifier for the team of the player featured in the leader record.
leader_weekintegerWeek number associated with the weekly leader record.
leader_yardsintegerYardage total associated with the featured leader statistic for this player.
leader_inPlayDistdoubleDistance (in yards) the player traveled while the ball was in play on the featured leader statistic.
leader_maxSpeeddoubleMaximum speed (in yards per second or mph) recorded by the player on the featured leader statistic play.
leader_headshotcharacterURL to the headshot image of the player featured in the leader record.
play_gameIdintegerNFL Shield API game identifier for the game this play belongs to.
play_playIdintegerNFL Shield API unique integer identifier for this play within the game.
play_sequenceintegerSequential order integer of this play within the game as used by the NFL Shield API.
play_downintegerDown number (1–4) at the time of this play.
play_gameClockcharacterGame clock time remaining at the start of this play in MM:SS format.
play_gameKeyintegerNFL Shield internal game key integer identifying the game in internal API routing.
play_health_playerTrackingcharacterData quality status string for player-tracking data on this play (e.g., 'GOOD', 'PARTIAL').
play_health_ballTrackingcharacterData quality status string for ball-tracking data on this play (e.g., 'GOOD', 'MISSING').
play_homeScoreintegerHome team's score at the end of this play.
play_isBigPlaylogicalBoolean flag indicating whether this play was classified as a 'big play' by the NFL Shield API.
play_isEndQuarterlogicalBoolean flag indicating whether this play was the final play of a quarter.
play_isGoalToGologicalBoolean flag indicating whether this play occurred in a goal-to-go situation.
play_isPenaltylogicalBoolean flag indicating whether a penalty was assessed on this play.
play_isSTPlaylogicalBoolean flag indicating whether this play was a special teams play.
play_isScoringlogicalBoolean flag indicating whether this play resulted in a score.
play_playDescriptioncharacterOfficial NFL text description of the play (e.g., '(2:11) J.Allen scrambles right end for 9 yards').
play_playStatecharacterStatus of the play record (e.g., 'FINAL', 'LIVE') in the NFL Shield API at time of capture.
play_playStatsintegerSerialized or encoded statistical detail for the play outcomes (e.g., yards, player IDs).
play_playTypecharacterText label classifying the play type (e.g., 'PASS', 'RUSH', 'PUNT') from the NFL Shield API.
play_playTypeCodeintegerInteger code corresponding to the play type classification in the NFL Shield API.
play_possessionTeamIdcharacterNFL Shield team identifier for the team that had possession during this play.
play_preSnapHomeScoreintegerHome team's score immediately before the snap of this play.
play_preSnapVisitorScoreintegerVisiting team's score immediately before the snap of this play.
play_quarterintegerQuarter number (1–4, or 5 for overtime) in which this play occurred.
play_timeOfDayUTCcharacterWall-clock timestamp in UTC at which this play occurred during the broadcast.
play_visitorScoreintegerVisiting team's score at the end of this play.
play_yardlinecharacterHuman-readable yardline string (e.g., 'DAL 22') indicating where this play began.
play_yardlineNumberintegerNumeric yard line (1–50 from nearest end zone) of the line of scrimmage at the snap.
play_yardlineSidecharacterTeam abbreviation indicating which team's side of the field the yardline is on.
play_yardsToGointegerInteger yards needed for a first down on this play.
play_absoluteYardlineNumberintegerAbsolute yard line number (1–100 from one end zone) of the line of scrimmage at the snap for this play.
play_actualYardlineForFirstDowndoubleActual yard line marker needed for a first down on this play.
play_actualYardsToGodoubleExact decimal yards required for a first down on this play.
play_endGameClockcharacterGame clock time remaining at the end of this play in MM:SS format.
play_isChangeOfPossessionlogicalBoolean flag indicating whether this play resulted in a change of possession.
play_playDirectioncharacterDirection of the play (left, right, middle) as recorded in NFL Shield tracking data.
play_startGameClockcharacterGame clock time remaining at the moment this play began, in MM:SS format.
leader_timedoubleElapsed time value associated with the leader record, such as time of possession or time-to-throw.
leader_seasonAvgdoubleSeason-to-date average of the featured leader statistic for this player.
leader_teamAvgdoubleTeam-level average of the featured statistic across all players on the team.
aggressivenessdoubleAggressiveness tracks the amount of passing attempts a quarterback makes that are into tight coverage, where there is a defender within 1 yard or less of the receiver at the time of completion or incompletion. AGG is shown as a % of attempts into tight windows over all passing attempts.
attemptsintegerThe number of pass attempts as defined by the NFL.
avgAirDistancedoubleAverage air distance (in yards) the ball traveled on all pass attempts, from NFL Next Gen Stats.
avgAirYardsDifferentialdoubleAverage difference between intended air yards and completed air yards per attempt, indicating whether the passer throws short or long relative to the targeted depth.
avgAirYardsToSticksdoubleAverage air yards relative to the first-down marker on pass attempts, from NFL Next Gen Stats (negative = short of sticks, positive = past sticks).
avgCompletedAirYardsdoubleAverage air yards on completed passes only, from NFL Next Gen Stats.
avgIntendedAirYardsdoubleAverage intended air yards per pass attempt (including incompletions), from NFL Next Gen Stats.
avgTimeToThrowdoubleAverage time in seconds from snap to throw for the passer, from NFL Next Gen Stats.
completionPercentagedoublePercentage of pass attempts completed by the passer, from NFL Next Gen Stats statboard leaders.
completionPercentageAboveExpectationdoublePasser's actual completion percentage minus their expected completion percentage based on target depth, coverage, and game context (CPOE), from NFL Next Gen Stats.
completionsintegerThe number of completed passes.
expectedCompletionPercentagedoubleModel-predicted completion percentage for the passer based on depth of target, receiver separation, and coverage, from NFL Next Gen Stats.
gamesPlayedintegerNumber of games played by the player in the given season or time period.
interceptionsintegerThe number of interceptions thrown.
maxAirDistancedoubleMaximum air distance (in yards) recorded on a single pass attempt by the passer, from NFL Next Gen Stats.
maxCompletedAirDistancedoubleMaximum air distance on a completed pass for the passer, from NFL Next Gen Stats.
passTouchdownsintegerTotal passing touchdowns recorded by the player in the given period.
passYardsintegerTotal passing yards recorded by the player in the given period.
passerRatingdoubleNFL passer rating (0–158.3 scale) for the quarterback in the given period.
playerNamecharacterFull display name of the player associated with this NGS statboard leader record.
seasoninteger4 digit number indicating to which season(s) the specified timeframe belongs to.
seasonTypecharacterPhase of the season for this record (e.g., 'REG' for regular season, 'POST' for playoffs).
positioncharacterPrimary position as reported by NFL.com
teamIdcharacterNFL Shield team identifier for the team associated with this leader statistic.
player_seasonintegerNFL season year in which this player record is valid.
player_currentTeamIdcharacterNFL Shield team identifier for the player's current team.
player_displayNamecharacterPlayer's full display name as used by NFL Next Gen Stats (e.g., 'Patrick Mahomes').
player_esbIdcharacterESB (Enterprise Subscriber Base) identifier assigned to this player by the NFL.
player_firstNamecharacterPlayer's first name as recorded in the NFL Next Gen Stats player roster.
player_footballNamecharacterPlayer's preferred football name (may differ from legal first name) used on the field and in broadcasts.
player_gsisIdcharacterGSIS (Game Statistics and Information System) identifier, the primary NFL player identifier used across nflverse datasets.
player_gsisItIdintegerGSIS integrated tracking identifier, an alternate integer-form player ID used in the NFL Shield tracking system.
player_jerseyNumberintegerPlayer's jersey number as worn on the field.
player_lastNamecharacterPlayer's last name as recorded in the NFL Next Gen Stats player roster.
player_positioncharacterPosition of the player accordinng to NGS
player_positionGroupcharacterOfficial NFL position group for the player (e.g., 'OFFENSE', 'DEFENSE', 'SPECIAL_TEAMS').
player_shortNamecharacterAbbreviated player name used in display contexts (e.g., 'P.Mahomes').
player_statuscharacterPlayer's current roster status (e.g., 'ACT' for active, 'IR' for injured reserve).
player_uniformNumbercharacterPlayer's uniform number as a string, matching what appears on the jersey.
player_headshotcharacterURL to the player headshot image.
player_smartIdcharacterNFL Smart ID — a system-agnostic unique identifier for the player used across NFL Shield systems.
player_ngsPositioncharacterPlayer's position as classified by NFL Next Gen Stats (may differ from official NFL position; e.g., NGS uses 'ILB' vs 'LB').
player_ngsPositionGroupcharacterBroad position group assigned by NFL Next Gen Stats (e.g., 'QB', 'WR', 'DB', 'DL').
avgCushiondoubleAverage distance (in yards) between the receiver and the nearest defender at the snap, from NFL Next Gen Stats receiver tracking.
avgExpectedYACdoubleAverage yards after catch expected based on game situation and receiver location, from NFL Next Gen Stats models.
avgSeparationdoubleAverage separation (in yards) between the receiver and the nearest defender at the moment of catch or incompletion, from NFL Next Gen Stats.
avgYACdoubleAverage yards after catch per reception, from NFL Next Gen Stats receiver tracking.
avgYACAboveExpectationdoubleAverage yards after catch above statistical expectation (YAC - expected YAC), from NFL Next Gen Stats models.
catchPercentagedoublePercentage of targets caught by the receiver, from NFL Next Gen Stats statboard leaders.
percentShareOfIntendedAirYardsdoubleReceiver's share (as a percentage) of the team's total intended air yards, from NFL Next Gen Stats.
recTouchdownsintegerTotal receiving touchdowns recorded by the player in the given period.
receptionsintegerThe number of pass receptions. Lateral receptions officially don't count as reception.
targetsintegerThe number of pass plays where the player was the targeted receiver.
yardsintegerThe number of receiving yards
avgTimeToLosdoubleAverage time (in seconds) for the ball carrier to reach the line of scrimmage on rush attempts, from NFL Next Gen Stats.
expectedRushYardsdoubleModel-predicted rushing yards based on field position, personnel, and pre-snap alignment, from NFL Next Gen Stats.
rushAttemptsintegerTotal rushing attempts by the player in the given period.
rushPctOverExpecteddoublePercentage of rush attempts on which the player gained more yards than the model-predicted expectation, from NFL Next Gen Stats.
rushTouchdownsintegerTotal rushing touchdowns recorded by the player in the given period.
rushYardsintegerTotal rushing yards recorded by the player in the given period.
rushYardsOverExpecteddoubleTotal rushing yards gained above statistical expectation (RYOE) in the given period, from NFL Next Gen Stats.
rushYardsOverExpectedPerAttdoubleAverage rushing yards over expected per attempt (RYOE/attempt), from NFL Next Gen Stats.

Example

from sportsdataverse.nfl import nfl_ngs_statboard_leaders
bd = nfl_ngs_statboard_leaders(season=2024, season_type="REG")
bd["category"].unique().to_list()

nfl_ngs_yac_oe​

nfl_ngs_yac_oe(seasons: 'Union[int, Sequence[int]]', *, min_receptions: 'int' = 10, return_as_pandas: 'bool' = False, _loader: 'Optional[Callable[..., pl.DataFrame]]' = None) -> 'Union[pl.DataFrame, pd.DataFrame]'

YAC over expected per receiver-season, stabilised with EB shrinkage.

yac_oe_raw is the NGS-shipped avg_yac_above_expectation passed through unchanged (per-reception yards after catch minus the NGS tracking-model expectation). yac_oe_shrunk applies per-season Efron-Morris empirical-Bayes shrinkage toward the reception-weighted league mean, weighted by receptions, so small-sample extremes are pulled in. The shrinkage prior is fit at call time on rows with receptions >= min_receptions — no bundled artifact.

Parameters

ParameterTypeDefaultDescription
seasonsUnion[int, Sequence[int]]Season(s) to compute, 2016+.
min_receptionsint10Qualification threshold for the prior fit and for receiving a yac_oe_rank. Defaults to sportsdataverse.nfl.nfl_ngs_constants.MIN_RECEPTIONS.
return_as_pandasboolFalseIf True, returns a pandas DataFrame.
_loaderOptional[Callable]NoneInjectable loader for offline tests.

Returns

One row per (season, player_gsis_id) with raw + shrunk YAC-OE, reliability in [0, 1], and a dense descending yac_oe_rank over qualified rows (null for unqualified rows). Empty input returns a zero-row frame with the documented schema.

col_nametypedescription
seasonintegerNFL season (YYYY).
player_gsis_idcharacterPlayer GSIS identifier (nflverse id, e.g. "00-0036223"), pinned Utf8.
player_display_namecharacterPlayer display name as shipped by NGS.
team_abbrcharacterTeam abbreviation.
positioncharacterPlayer position (from NGS player_position).
receptionsdoubleSeason reception count — the shrinkage weight.
avg_yacdoubleAverage yards after catch per reception.
avg_expected_yacdoubleNGS tracking-model expected YAC per reception.
yac_oe_rawdoubleNGS avg_yac_above_expectation passed through unchanged — per-reception YAC minus the tracking-model expectation.
yac_oe_shrunkdoubleyac_oe_raw after per-season empirical-Bayes shrinkage toward the reception-weighted league mean (sampling variance identified from weekly rows).
reliabilitydoubleShrinkage reliability tau2 / (tau2 + sigma2 / receptions) in [0, 1]; the fraction of the raw deviation retained.
yac_oe_rankintegerDense descending rank of yac_oe_shrunk within season over qualified rows; null when receptions < min_receptions.

Example

from sportsdataverse.nfl import nfl_ngs_yac_oe
df = nfl_ngs_yac_oe([2023])
print(df.sort("yac_oe_rank").head())

# Pandas output

df_pd = nfl_ngs_yac_oe(2023, return_as_pandas=True)

nfl_play_call_probabilities​

nfl_play_call_probabilities(pbp: 'pl.DataFrame', participation: 'Optional[pl.DataFrame]' = None, *, models_dir: 'Optional[str]' = None, return_as_pandas: 'bool' = False) -> "Union[pl.DataFrame, 'pd.DataFrame']"

Score the bundled play-call classifier over offensive plays.

Parameters

ParameterTypeDefaultDescription
pbpDataFramenflverse-format pbp (must carry xpass; run sportsdataverse.nfl.ep_wp.calculate_xpass first if not).
participationOptional[DataFrame]NoneOptional participation frame for personnel features.
models_dirOptional[str]NoneOptional directory holding nfl_playcall.ubj (defaults to the bundled package artifact; no first-use download).
return_as_pandasboolFalseWhen True, return a pandas.DataFrame.

Returns

Keys + per-family probabilities p_inside_run / p_outside_run / p_short_pass / p_deep_pass / p_scramble, p_pass (pass-family sum), pred_family (argmax) and pass_oe_model (100 * (is_pass - p_pass)). Empty input yields a zero-row frame with this schema.

col_nametypedescription
game_idcharacternflverse game identifier (Utf8 join key).
play_idintegernflverse play identifier within the game (Int64 join key).
seasonintegerSeason of the play.
weekintegerWeek of the play.
posteamcharacterOffense (possession) team abbreviation.
p_inside_rundoublePredicted probability of an inside run (guard/center gap or middle).
p_outside_rundoublePredicted probability of an outside run (end/tackle or off-middle).
p_short_passdoublePredicted probability of a short pass.
p_deep_passdoublePredicted probability of a deep pass.
p_scrambledoublePredicted probability of a QB scramble.
p_passdoublePredicted pass probability (short + deep + scramble family sum).
pred_familycharacterArgmax family among the five class probabilities.
pass_oe_modeldoublePass-rate over model expectation for the play, 100 * (is_pass - p_pass).

Example

from sportsdataverse.nfl import load_nfl_pbp
from sportsdataverse.nfl.ep_wp import calculate_xpass
from sportsdataverse.nfl.nfl_playcall import nfl_play_call_probabilities
out = nfl_play_call_probabilities(calculate_xpass(load_nfl_pbp([2023])))
print(out.select("p_pass", "pred_family").head())

# Pipeline next step

out.group_by("posteam").agg(pl.col("p_pass").mean()).sort("p_pass")

nfl_play_call_tendencies​

nfl_play_call_tendencies(pbp: 'pl.DataFrame', participation: 'Optional[pl.DataFrame]' = None, *, models_dir: 'Optional[str]' = None, return_as_pandas: 'bool' = False) -> "Union[pl.DataFrame, 'pd.DataFrame']"

Aggregate scored play-call probabilities to team-season tendencies.

Parameters

ParameterTypeDefaultDescription
pbpDataFramenflverse-format pbp (with xpass).
participationOptional[DataFrame]NoneOptional participation frame.
models_dirOptional[str]NoneOptional directory holding nfl_playcall.ubj.
return_as_pandasboolFalseWhen True, return a pandas.DataFrame.

Returns

Per (season, posteam): plays, mean_p_pass, pass_rate, proe (100 * (pass_rate - mean_p_pass)) and the family mix shares share_<family>. Empty input yields a zero-row frame.

col_nametypedescription
seasonintegerSeason of the aggregate.
posteamcharacterOffense team abbreviation.
playsintegerOffensive run/pass plays scored.
mean_p_passdoubleMean model pass probability across the team's plays.
pass_ratedoubleActual pass rate (scrambles count as passes).
proedoublePass rate over expected, 100 * (pass_rate - mean_p_pass).
share_inside_rundoubleShare of plays labeled inside_run.
share_outside_rundoubleShare of plays labeled outside_run.
share_short_passdoubleShare of plays labeled short_pass.
share_deep_passdoubleShare of plays labeled deep_pass.
share_scrambledoubleShare of plays labeled scramble.

Example

from sportsdataverse.nfl import load_nfl_pbp
from sportsdataverse.nfl.ep_wp import calculate_xpass
from sportsdataverse.nfl.nfl_playcall import nfl_play_call_tendencies
t = nfl_play_call_tendencies(calculate_xpass(load_nfl_pbp([2023])))
print(t.sort("proe", descending=True).head())

nfl_player_projection​

nfl_player_projection(seasons: 'List[int]', target_season: 'int', *, return_as_pandas: 'bool' = False) -> "Union[pl.DataFrame, 'pd.DataFrame']"

Marcel-style next-season player projection with delta-method aging.

Loads weekly player stats + rosters, aggregates to season rates, and for every player visible in seasons strictly before target_season (the as-of-date leakage boundary) produces a recency-weighted rate blend regressed toward the volume-weighted position mean by k / (k + reliability), scaled by the position aging-curve ratio aging_mult(proj_age) / aging_mult(current_age). The aging curve is fit only on the same pre-target history.

Parameters

ParameterTypeDefaultDescription
seasonsList[int]History seasons to load (seasons >= target_season are discarded by the leakage split).
target_seasonintThe season being projected.
return_as_pandasboolFalseIf True, returns a pandas dataframe.

Returns

One row per projected player: player_id:Utf8, target_season:Int64, position_group:Utf8, proj_age:Float64, proj_ppg:Float64, proj_volume:Float64, proj_games:Float64, aging_mult:Float64, reliability:Float64 plus proj_<stat>_rate component-rate columns. Empty history returns a zero-row frame.

col_nametypedescription
player_idcharacternflverse gsis player id (character join key).
target_seasonintegerThe season being projected (features use strictly earlier seasons only - the as-of-date leakage boundary).
position_groupcharacternflverse offensive position group (QB/RB/WR/TE plus fringe groups).
proj_agedoubleProjected age at the target season (age at last visible season + season gap).
proj_ppgdoubleProjected PPR fantasy points per game - recency-weighted rate blend regressed toward the volume-weighted position mean by k/(k + reliability), scaled by the damped aging-curve ratio.
proj_volumedoubleProjected position-specific opportunity volume (QB = pass attempts, RB = carries + targets, WR/TE = targets).
proj_gamesdoubleRecency-weighted mean of historical games played.
aging_multdoubleApplied aging multiplier - the damped, clamped ratio aging_curve(proj_age) / aging_curve(current_age).
reliabilitydoubleRecency-weighted volume sum - the shrinkage evidence weight.
proj_completions_ratedoubleProjected per-game pass completions (Marcel blend x aging ratio).
proj_attempts_ratedoubleProjected per-game pass attempts (Marcel blend x aging ratio).
proj_passing_yards_ratedoubleProjected per-game passing yards (Marcel blend x aging ratio).
proj_passing_tds_ratedoubleProjected per-game passing touchdowns (Marcel blend x aging ratio).
proj_interceptions_ratedoubleProjected per-game interceptions thrown (Marcel blend x aging ratio).
proj_carries_ratedoubleProjected per-game rush attempts (Marcel blend x aging ratio).
proj_rushing_yards_ratedoubleProjected per-game rushing yards (Marcel blend x aging ratio).
proj_rushing_tds_ratedoubleProjected per-game rushing touchdowns (Marcel blend x aging ratio).
proj_receptions_ratedoubleProjected per-game receptions (Marcel blend x aging ratio).
proj_targets_ratedoubleProjected per-game targets (Marcel blend x aging ratio).
proj_receiving_yards_ratedoubleProjected per-game receiving yards (Marcel blend x aging ratio).
proj_receiving_tds_ratedoubleProjected per-game receiving touchdowns (Marcel blend x aging ratio).
proj_receiving_air_yards_ratedoubleProjected per-game receiving air yards (Marcel blend x aging ratio).
proj_fumbles_lost_ratedoubleProjected per-game fumbles lost (Marcel blend x aging ratio).

Example

from sportsdataverse.nfl.nfl_projection import nfl_player_projection
proj = nfl_player_projection([2021, 2022, 2023], 2024)
proj.sort("proj_ppg", descending=True).head()

# Pandas round-trip

proj_pd = nfl_player_projection([2021, 2022, 2023], 2024, return_as_pandas=True)

nfl_player_props​

nfl_player_props(seasons: 'int | list[int]', *, as_of_date: 'datetime.date | None' = None, era: 'str' = 'modern', lines: 'pl.DataFrame | None' = None, return_as_pandas: 'bool' = False) -> 'pl.DataFrame | pd.DataFrame'

Empirical-Bayes player-prop projections, leakage-safe per week.

For every game in the requested season(s) (or, with as_of_date, every game on/after that date), projects each rostered QB/RB/WR/TE's stat-family mean as usage x efficiency x matchup x game-script:

  • usage + efficiency from player_usage_efficiency built as-of that game's week (weeks strictly before it),
  • the matchup multiplier from the opponent's adj_def_epa in sportsdataverse.nfl.nfl_ratings.nfl_ratings (as-of the week's first game date),
  • game script from the native expected margin (sportsdataverse.nfl.nfl_market.nfl_predict_games) -- the market line is never read (binding non-market boundary).

Parameters

ParameterTypeDefaultDescription
seasonsint | list[int]Season (e.g. 2023) or list of seasons.
as_of_datedate | NoneNoneWhen given, only games with gameday >= as_of_date are projected (history before each game's week still feeds the projections). None projects every week of the season(s).
erastr'modern'Constants era key.
linesDataFrame | NoneNoneOptional market lines to score p_over against -- columns game_id / player_id / stat (Utf8) + line (Float64), e.g. built from espn_nfl_game_propbets (ESPN only serves propbets for upcoming games). None leaves line / p_over null.
return_as_pandasboolFalseIf True, returns a pandas DataFrame.

Returns

One row per (player-game, stat): season / week (Int64), game_id / player_id / position / team_id / opp_team_id / stat (Utf8), proj_mean / proj_sd / line / p_over (Float64; p_over = 1 - Phi((line - proj_mean) / proj_sd) when a line is joined, else null). Stats are passing_yards (QB), rushing_yards (RB), receiving_yards (WR/TE). Zero-row, correctly-typed when there is nothing to project.

col_nametypedescription
seasonintegerSeason the projection belongs to.
weekintegerWeek of the projected game; only weeks strictly before it feed the projection.
game_idcharacterGame identifier from the schedule (nflverse id, e.g. "2023_06_DET_TB").
player_idcharacternflverse GSIS player identifier (character join key).
positioncharacterPlayer position (QB, RB, WR, TE) selecting the projected stat family.
team_idcharacterPlayer's team nflverse abbreviation as of the projection week.
opp_team_idcharacterOpponent team nflverse abbreviation (drives the matchup multiplier).
statcharacterProjected stat name (passing_yards for QB, rushing_yards for RB, receiving_yards for WR/TE).
proj_meandoubleProjected stat mean - EB-shrunk usage x efficiency x opponent matchup x game-script.
proj_sddoubleResidual standard deviation for the stat family (fitted on the 2023 as-of backtest).
linedoubleMarket prop line joined from the caller-supplied lines frame (e.g. espn_nfl_game_propbets); null when no line is available.
p_overdoubleProbability the player exceeds line, 1 - Phi((line - proj_mean) / proj_sd); null without a line.

Example

from sportsdataverse.nfl import nfl_player_props
props = nfl_player_props(2023)
props.filter(props["stat"] == "passing_yards").head()

# Upcoming-only, as-of a date

import datetime as dt
props = nfl_player_props(2024, as_of_date=dt.date(2024, 11, 1))

nfl_players_crosswalk​

nfl_players_crosswalk(*, return_as_pandas: 'bool' = False) -> "Union[pl.DataFrame, 'pd.DataFrame']"

Pure-consumer ID crosswalk sliced from load_nfl_players.

Reads nflverse's published players master and projects it down to just the cross-system identifier columns it carries (gsis_id, esb_id, espn_id, pfr_id, pff_id, otc_id, nfl_id, smart_id — whichever the parquet exposes) plus full_name and position, deduped on gsis_id. The players master has no Yahoo or CBS ids, so yahoo_id and cbs_id are joined on gsis_id from load_nfl_ff_playerids (DynastyProcess). A gsis_id that DynastyProcess lists twice is ambiguous upstream and gets null provider ids. It is a convenience for joining identity IDs onto PBP / rosters / stats frames without carrying the full ~40-column master.

Parameters

ParameterTypeDefaultDescription
return_as_pandasboolFalseIf True, return a pandas.DataFrame; otherwise a polars.DataFrame (default).

Returns

A one-row-per-gsis_id DataFrame of cross-system IDs (all Utf8) + full_name / position, with yahoo_id / cbs_id null where DynastyProcess has no unambiguous match (or its load fails). A failed / empty players load yields a zero-row frame carrying the same column set (never a raise).

Example

from sportsdataverse.nfl import nfl_players_crosswalk
xwalk = nfl_players_crosswalk()
print(xwalk.columns)

# Join nflverse IDs onto a PBP frame (one line)

pbp.join(nfl_players_crosswalk(), left_on="passer_player_id", right_on="gsis_id", how="left")

nfl_predict_games​

nfl_predict_games(games: 'pl.DataFrame', ratings: 'pl.DataFrame', *, era: 'str' = 'modern', odds: 'pl.DataFrame | None' = None, return_as_pandas: 'bool' = False) -> 'pl.DataFrame | pd.DataFrame'

Vectorized pregame predictions (+ display-only market edge) per game.

Joins ratings twice (home/away) onto the schedule and computes the three closed-form predictions. odds is display-only: it feeds market_edge = exp_margin - close_spread_home and never the predictions themselves (the binding non-market boundary).

Parameters

ParameterTypeDefaultDescription
gamesDataFrameOne row per game: game_id (Utf8), home_team_id / away_team_id (Utf8 team abbreviations), neutral_site (Boolean).
ratingsDataFrameThe sportsdataverse.nfl.nfl_ratings.nfl_ratings output (needs team_id, adj_off_epa, adj_def_epa, adj_net).
erastr'modern'Constants era key.
oddsDataFrame | NoneNoneOptional market frame (game_id, close_spread_home -- the market's expected home margin, positive = home favored). Games absent from odds get a null market_edge.
return_as_pandasboolFalseIf True, returns a pandas DataFrame.

Returns

One row per input game: game_id / home_team_id / away_team_id (Utf8), neutral_site (Boolean), exp_margin / home_win_prob / exp_total / market_edge (Float64; market_edge null without odds). Zero-row, correctly-typed on empty input.

col_nametypedescription
game_idcharacterGame identifier carried through from the input schedule.
home_team_idcharacterHome team nflverse abbreviation (character; the ratings team_id join key).
away_team_idcharacterAway team nflverse abbreviation (character; the ratings team_id join key).
neutral_sitelogicalWhether the game is at a neutral site (home-field advantage is dropped when true).
exp_margindoubleExpected home scoring margin in points (points_per_net * net rating differential + the fitted home-field advantage on non-neutral fields).
home_win_probdoubleHome win probability, Phi(exp_margin / margin_sd) under a Gaussian margin model.
exp_totaldoubleExpected combined point total (avg_total + total_scale * the four-way efficiency matchup sum).
market_edgedoubleDisplay-only native-minus-market spread edge (exp_margin - close_spread_home); null when no odds frame is supplied.

Example

from sportsdataverse.nfl import nfl_ratings
from sportsdataverse.nfl.nfl_market import nfl_predict_games
ratings = nfl_ratings(2023)
preds = nfl_predict_games(games, ratings)
preds.sort("home_win_prob", descending=True).head()

# With a market edge (display only)

preds = nfl_predict_games(games, ratings, odds=odds)

nfl_punter_value​

nfl_punter_value(seasons: 'Union[int, List[int]]', *, return_as_pandas: 'bool' = False) -> "Union[pl.DataFrame, 'pd.DataFrame']"

Punter net-field-position value over expected.

Expected net comes from the shipped punt landing distribution (nfl_fourth_down._load_punt_data) evaluated at each punt's line of scrimmage; realized net is kick_distance - return_yards - 20*touchback.

Parameters

ParameterTypeDefaultDescription
seasonsUnion[int, List[int]]Season or list of seasons.
return_as_pandasboolFalseWhen True, return a pandas.DataFrame.

Returns

Per (season, punter_player_id): punts, gross_avg, net_avg, exp_net_avg, net_over_expected, epa. Empty seasons yield a zero-row frame with this schema.

col_nametypedescription
seasonintegerSeason of the aggregate.
punter_player_idcharacternflverse punter GSIS id (Utf8 join key).
puntsintegerPunts with a recorded kick distance.
gross_avgdoubleMean gross punt distance (yards).
net_avgdoubleMean net distance, kick_distance - return_yards - 20 * touchback.
exp_net_avgdoubleMean expected net from the shipped punt landing distribution at each punt's line of scrimmage.
net_over_expecteddoublenet_avg minus exp_net_avg (yards of field position per punt over expectation).
epadoubleTotal EPA on the punter's punt plays (kicking-team perspective).

Example

from sportsdataverse.nfl.nfl_special_teams import nfl_punter_value
pv = nfl_punter_value([2023])
print(pv.head())

nfl_ratings​

nfl_ratings(seasons: 'int | list[int]', *, as_of_date: 'datetime.date | None' = None, config: 'RatingsConfig | None' = None, return_as_pandas: 'bool' = False) -> 'pl.DataFrame | pd.DataFrame'

One row per team: the native NFL ratings spine (off/def/ST EPA).

Public orchestrator over efficiency_ratings + special_teams_ratings. Loads play-by-play + schedule via load_nfl_pbp / load_nfl_schedule, joins each game's gameday onto the plays, optionally applies the as-of-date leakage boundary (only plays from games with gameday < as_of_date are used), then fits both components and reshapes into one wide per-team table with dense ranks and a net z-score.

The loaded pbp is down-selected to the ridge columns before any fit so no market column (spread_line / vegas_wp) can leak into the ratings (the binding non-market boundary).

Parameters

ParameterTypeDefaultDescription
seasonsint | list[int]A single season (e.g. 2023) or a list of seasons pooled into one combined fit.
as_of_datedate | NoneNoneWhen given, only plays from games strictly before this date are used (mirrors what was knowable heading into that date). None (default) uses the full season(s).
configRatingsConfig | NoneNoneTuning knobs forwarded to both component fits; defaults to RatingsConfig.
return_as_pandasboolFalseIf True, returns a pandas DataFrame.

Returns

A DataFrame with one row per team_id: season (Int64 -- the single passed season, null for a pooled multi-season call), team_id (Utf8), adj_off_epa / adj_def_epa / adj_st_epa / adj_net (Float64; adj_net is offense minus defense -- special teams stays a separate column), games (Int64), off_rank / def_rank / net_rank (Int64; def_rank ascends -- fewer EPA allowed ranks better), net_z (Float64). Zero-row, correctly-typed when the seasons have no data or as_of_date filters out every play.

col_nametypedescription
seasonintegerSeason the ratings cover (null for a pooled multi-season fit).
team_idcharacternflverse team abbreviation (character join key, e.g. "KC").
adj_off_epadoubleOpponent-adjusted offensive EPA per play (higher is better); competitive-play ridge fit.
adj_def_epadoubleOpponent-adjusted defensive EPA allowed per play (lower is better); competitive-play ridge fit.
adj_st_epadoubleOpponent-adjusted special-teams EPA per play (ridge on special==1 plays; 0.0 for teams with no special-teams plays in the window).
adj_netdoubleOpponent-adjusted net efficiency (adj_off_epa minus adj_def_epa; special teams not folded in).
gamesintegerNumber of games the team played in the fitted window.
off_rankintegerDense rank on adj_off_epa descending (best offense = 1).
def_rankintegerDense rank on adj_def_epa ascending (fewer EPA allowed ranks better).
net_rankintegerDense rank on adj_net descending (best net rating = 1).
net_zdoubleZ-score of adj_net across the 32 teams.

Example

from sportsdataverse.nfl import nfl_ratings
ratings = nfl_ratings(2023)
ratings.sort("net_rank").head()

# As-of-date leakage boundary

import datetime as dt
week6 = nfl_ratings(2023, as_of_date=dt.date(2023, 10, 12))

nfl_season_standings​

nfl_season_standings(games: 'pl.DataFrame', *, ranks: 'str' = 'CONF', tiebreaker_depth: 'str' = 'SOS', playoff_seeds: 'Optional[int]' = None, return_as_pandas: 'bool' = False) -> "Union[pl.DataFrame, 'pd.DataFrame']"

Compute NFL standings with the real NFL tiebreaking procedures.

Faithful polars port of nflseedR::nfl_standings() (v2 engine, R/standings.R L82-155): initializes records, points, win percentages, SOV and SOS from a games frame, then resolves division ranks, conference ranks (playoff seeds) and draft order through the full NFL tiebreaker cascades.

Parameters

ParameterTypeDefaultDescription
gamesDataFrameGames frame with one row per game. Required columns: sim or season (identifier), game_type ('REG', 'WC', 'DIV', 'CON', 'SB'), week, away_team, home_team, and result (home score minus away score; no missing values allowed). away_score / home_score are additionally required for tiebreaker_depth='POINTS' and enable the pf/pa/pd output columns.
ranksstr'CONF'One of 'DIV', 'CONF' (default), 'DRAFT', or 'NONE' — which rank columns (and thus tiebreakers) to compute. 'DRAFT' implies 'CONF' implies 'DIV'.
tiebreaker_depthstr'SOS'One of 'SOS' (default), 'PRE-SOV', 'POINTS', or 'RANDOM'. Controls how deep the tiebreaker cascade goes before falling back to a coin toss.
playoff_seedsOptional[int]NoneIf not None, only conference ranks up to this value are resolved with tiebreakers; deeper ranks are returned as null. Must be in 1-16.
return_as_pandasboolFalseIf True, return a pandas DataFrame.

Returns

A standings frame with one row per (sim/season, team) including records, win_pct/div_pct/conf_pct, sov, sos, and the requested div_rank/conf_rank/draft_rank columns plus *_tie_broken_by bookkeeping. conf_rank is the playoff seed.

col_nametypedescription
seasonintegerSeason identifier from the input games frame (named sim instead when the input used a sim column).
confcharacterConference of the team (AFC or NFC).
divisioncharacterDivision of the team (e.g. "AFC East").
teamcharacterTeam abbreviation.
gamesintegerNumber of regular season games played.
winsdoubleRegular season wins with ties counted as half a win.
true_winsintegerRegular season wins excluding ties (outright wins only).
lossesintegerRegular season losses.
tiesintegerRegular season ties.
pfintegerPoints scored across regular season games (points for); present only when the input carries home_score and away_score.
paintegerPoints allowed across regular season games (points against); present only when the input carries scores.
pdintegerRegular season point differential (pf minus pa); present only when the input carries scores.
win_pctdoubleRegular season win percentage with ties counted as half a win.
div_pctdoubleWin percentage in games against division opponents (0 when the team played no division games).
conf_pctdoubleWin percentage in games against conference opponents (0 when the team played no conference games).
sovdoubleStrength of victory - combined win percentage of all opponents the team defeated (0 for winless teams).
sosdoubleStrength of schedule - combined win percentage of all opponents the team faced.
div_rankintegerRank within the division (1-4) after applying the NFL division tiebreaking procedures.
div_tie_broken_bycharacterTiebreaker step that resolved the team's division rank (e.g. "Head-To-Head Win PCT (2)" or "Coin Toss"); null when the rank needed no tiebreaker.
conf_rankintegerConference rank, i.e. the playoff seed, after applying the NFL conference tiebreaking procedures; null beyond playoff_seeds when that argument is set.
conf_tie_broken_bycharacterTiebreaker step that resolved the team's conference rank; null when the rank needed no tiebreaker.
exitcharacterRound of the team's final game - REG, WC, DIV, CON, SB, or SB_WIN for the Super Bowl winner (returned with ranks="DRAFT").
draft_rankintegerDraft pick position (1 = first overall pick) derived from postseason exit, win percentage, SOS and the draft tiebreaking procedures (returned with ranks="DRAFT").
draft_tie_broken_bycharacterTiebreaker step that resolved the team's draft rank; null when the rank needed no tiebreaker.

Example

import sportsdataverse.nfl as nfl
games = nfl.load_schedules([2024])
standings = nfl.nfl_season_standings(games, ranks="DRAFT")
print(standings.shape)

# Playoff seeds only, pandas output

df = nfl.nfl_season_standings(
games, ranks="CONF", playoff_seeds=7, return_as_pandas=True
)

# Pipeline next step (one line)

standings.filter(pl.col("conf_rank") <= 7).sort("conf", "conf_rank")