Skip to main content
Version: 0.0.75

MLB dataset loaders

flowchart LR
raw["scrape / raw"] --> enrich["enrich"] --> rel["release asset"] --> load["load_*()"]

Automation status

DatasetRelease tagPipeline
load_mlb_re24_matrixmlb_game_state
load_mlb_we_tablemlb_game_state
load_mlb_wpamlb_game_state
load_mlb_expected_statsmlb_hitting_models
load_mlb_expected_hrmlb_hitting_models
load_mlb_batter_projectionmlb_hitting_models
load_mlb_oaamlb_fielding_models
load_mlb_catcher_framingmlb_fielding_models
load_mlb_xeramlb_pitching_models
load_mlb_stuff_plusmlb_pitching_models
load_mlb_command_plusmlb_pitching_models
load_ncaa_baseball_pbpncaa_baseball_pbp
load_ncaa_baseball_schedulencaa_baseball_schedules

load_mlb_re24_matrix

Release: mlb_game_state · asset https://github.com/sportsdataverse/sportsdataverse-data/releases/download/mlb_game_state/mlb_re24_matrix_{season}.parquet

Returns

col_nametypedescription
base_stateStringThree-character pre-play base occupancy where each slot carries its base number when occupied and an underscore when empty, so ___ is bases empty and 123 is bases loaded.
outsInt64Outs in the inning after the play.
reFloat64Mean runs the batting team went on to score from this base-out state through the end of the half-inning, with bottom-of-the-9th-and-later halves excluded to avoid walk-off selection bias.
nUInt32Plate appearances observed starting in this base-out state, the sample size behind re.
seasonInt64Season year.
load_mlb_re24_matrix(seasons=2024)

load_mlb_we_table

Release: mlb_game_state · asset https://github.com/sportsdataverse/sportsdataverse-data/releases/download/mlb_game_state/mlb_we_table_{season}.parquet

Returns

col_nametypedescription
inning_cappedInt64Inning number with the ninth and every extra inning collapsed into 9, so extras share the ninth-inning win-expectancy cells.
halfStringHalf of the game (1 or 2).
base_stateStringThree-character pre-play base occupancy where each slot carries its base number when occupied and an underscore when empty, so ___ is bases empty and 123 is bases loaded.
outs_startInt64Outs already recorded when the plate appearance began, normally 0 through 2, though a handful of published rows carry a stale 3 that the RE24 matrix filters out but this table does not.
score_diff_bucketInt64Home score minus away score before the play, clipped to the range -6 through +6 so blowouts collapse into the end buckets.
home_win_expFloat64Home team win expectancy before the play.
nUInt32Plate appearances observed in this state bucket, the sample size behind the Laplace-smoothed home_win_exp.
seasonInt64Season year.
load_mlb_we_table(seasons=2024)

load_mlb_wpa

Release: mlb_game_state · asset https://github.com/sportsdataverse/sportsdataverse-data/releases/download/mlb_game_state/mlb_wpa_{season}.parquet

Returns

col_nametypedescription
game_idStringUnique ESPN game/event identifier.
at_bat_indexInt64Zero-based index of the at-bat within the game.
wpaFloat64Win probability added (WPA) for the posteam.
seasonInt64Season year.
load_mlb_wpa(seasons=2024)

load_mlb_expected_stats

Release: mlb_hitting_models · asset https://github.com/sportsdataverse/sportsdataverse-data/releases/download/mlb_hitting_models/mlb_expected_stats_{season}.parquet

Returns

col_nametypedescription
batterInt64MLBAM player id of the batter.
seasonInt64Season year.
paInt64Statcast rows charged to the batter for the season, counting balls in play carrying launch data plus every other pitch, so it is a pitch-row total rather than a true plate-appearance count.
abInt64At-bats.
xwobaFloat64Expected wOBA blending the exit-velocity by launch-angle grid's predicted contact value on balls in play with realized wOBA value on walks, hit-by-pitches and strikeouts, over the wOBA denominator; low-sample batters can exceed 1.
xbaFloat64Sum of grid-predicted hit probability over the batter's balls in play divided by ab, which lands far below conventional batting-average scale because ab counts pitch rows rather than at-bats.
xslgFloat64Sum of grid-predicted total bases over the batter's balls in play divided by ab, which lands far below conventional slugging scale because ab counts pitch rows rather than at-bats.
load_mlb_expected_stats(seasons=2024)

load_mlb_expected_hr

Release: mlb_hitting_models · asset https://github.com/sportsdataverse/sportsdataverse-data/releases/download/mlb_hitting_models/mlb_expected_hr_{season}.parquet

Returns

col_nametypedescription
batterInt64MLBAM player id of the batter.
seasonInt64Season year.
hrInt64Home runs hit by the batter over the covered sample.
xhr_neutralFloat64Park-neutral expected home runs, summing over the batter's balls in play the home-run probability read off the exit-velocity by launch-angle by spray-angle grid.
xhr_park_adjFloat64The same expected-home-run sum after scaling each ball by its ballpark's Savant home-run park factor over 100; published values run between 0.77 and 1.26 times xhr_neutral.
hr_above_expectedFloat64Home runs actually hit minus xhr_neutral, so it grades over- and under-performance against the park-neutral expectation rather than the park-adjusted one.
load_mlb_expected_hr(seasons=2024)

load_mlb_batter_projection

Release: mlb_hitting_models · asset https://github.com/sportsdataverse/sportsdataverse-data/releases/download/mlb_hitting_models/mlb_batter_projection_{season}.parquet

Returns

col_nametypedescription
batterInt64MLBAM player id of the batter.
ageInt64Player age (in years).
proj_xwobaFloat64Projected expected weighted on-base average for the batter.
proj_paFloat64Combined prior-three-season pa behind the projection, its effective sample size; it inherits the pitch-row counting of load_mlb_expected_stats pa rather than true plate appearances.
load_mlb_batter_projection(seasons=2024)

load_mlb_oaa

Release: mlb_fielding_models · asset https://github.com/sportsdataverse/sportsdataverse-data/releases/download/mlb_fielding_models/mlb_oaa_{season}.parquet

Returns

col_nametypedescription
fielder_idStringMLBAM identifier of the fielder charged with the ball in play, resolved from whichever fielder_N column matches the responsible position and published as a string rather than an integer.
positionInt64Listed roster position (G, F, C, etc.).
opportunitiesUInt32Balls in play charged to this fielder at this position, the sample the oaa sum runs over.
oaaFloat64Outs above average: outs the fielder actually recorded minus what a per-position catch-probability logistic expected from the same batted-ball trajectories, summed across their opportunities.
seasonInt64Season year.
load_mlb_oaa(seasons=2024)

load_mlb_catcher_framing

Release: mlb_fielding_models · asset https://github.com/sportsdataverse/sportsdataverse-data/releases/download/mlb_fielding_models/mlb_catcher_framing_{season}.parquet

Returns

col_nametypedescription
catcher_idStringMLBAM identifier of the receiving catcher, taken from Savant's fielder_2 and published as a string rather than an integer.
takesUInt32Called strikes plus balls the catcher received across the season, a pure workload count; the framing figures themselves sum only over the shadow-zone subset of these.
framing_runsFloat64Runs saved by receiving, summing actual called strike minus modeled strike probability times that count's strike run value over shadow-zone takes only.
strikes_gainedFloat64The same shadow-zone sum of actual called strike minus modeled strike probability left unweighted by run value, so it measures stolen strikes rather than runs.
seasonInt64Season year.
load_mlb_catcher_framing(seasons=2024)

load_mlb_xera

Release: mlb_pitching_models · asset https://github.com/sportsdataverse/sportsdataverse-data/releases/download/mlb_pitching_models/mlb_xera_{season}.parquet

Returns

col_nametypedescription
pitcherInt64Whether the position is a pitcher.
seasonInt64Season year.
x_wobaFloat64Expected weighted on-base average, derived from batted-ball quality rather than outcomes.
x_eraFloat64ERA-scale conversion of x_woba as league_era plus (x_woba minus league_woba) over woba_scale times pa_per_9, an exact linear function of x_woba that can go negative for extreme pitchers.
load_mlb_xera(seasons=2024)

load_mlb_stuff_plus

Release: mlb_pitching_models · asset https://github.com/sportsdataverse/sportsdataverse-data/releases/download/mlb_pitching_models/mlb_stuff_plus_{season}.parquet

Returns

col_nametypedescription
pitcherInt64Whether the position is a pitcher.
pitch_typeStringAbbreviation of the pitch type thrown (e.g. FF, SL, CH).
stuff_rv_hatFloat64Mean predicted per-pitch run value from the bundled xgboost stuff model over this pitcher's pitches of this type, on Savant's batter-perspective delta_run_exp scale so lower is better for the pitcher.
stuff_plusFloat64Stuff+ on the 100-is-average scale, exactly 100 minus 10 times (stuff_rv_hat minus the league mean) over the league SD, so higher is better and outlier run-value predictions can push it well below zero.
seasonInt64Season year.
load_mlb_stuff_plus(seasons=2024)

load_mlb_command_plus

Release: mlb_pitching_models · asset https://github.com/sportsdataverse/sportsdataverse-data/releases/download/mlb_pitching_models/mlb_command_plus_{season}.parquet

Returns

col_nametypedescription
pitcherInt64Whether the position is a pitcher.
location_rv_hatFloat64Mean predicted per-pitch run value from the bundled location model, which sees plate location, count, handedness and pitch type but no raw pitch physics; lower is better for the pitcher.
command_plusFloat64Command+/Location+ on the 100-is-average scale, exactly 100 minus 10 times (location_rv_hat minus the league mean) over the league SD; it grades where the pitch finished, not intent, since Statcast ships no catcher target.
seasonInt64Season year.
load_mlb_command_plus(seasons=2024)

load_ncaa_baseball_pbp

Release: ncaa_baseball_pbp · asset https://github.com/sportsdataverse/sportsdataverse-data/releases/download/ncaa_baseball_pbp/ncaa_baseball_pbp_{season}.parquet

Returns

col_nametypedescription
game_dateStringGame date (YYYY-MM-DD).
locationStringTeam city/region (e.g. "Los Angeles").
attendanceBooleanReported attendance (NA on the redesigned page).
inningStringInning number.
inning_top_botStringHalf-inning ("top" or "bot").
scoreStringRunning score (away-home) after the play.
battingStringWhether the situation applies to batting stats.
fieldingStringWhether the situation applies to fielding stats.
descriptionStringLong-form description text.
yearInt32Season (4-digit year).
game_pbp_urlStringstats.ncaa.org play-by-play url for the game.
game_pbp_idInt32stats.ncaa.org play-by-play (contest) identifier.
game_info_urlStringFull stats.ncaa.org box-score url for the game.
contest_idInt32stats.ncaa.org contest (game) identifier.
load_ncaa_baseball_pbp(seasons=2023)

load_ncaa_baseball_schedule

Release: ncaa_baseball_schedules · asset https://github.com/sportsdataverse/sportsdataverse-data/releases/download/ncaa_baseball_schedules/ncaa_baseball_schedule_{season}.parquet

Returns

col_nametypedescription
yearInt32Season (4-digit year).
season_idInt32stats.ncaa.org season identifier.
dateStringDate in YYYY-MM-DD format.
home_teamStringHome team name.
home_team_idInt32Home team id.
home_team_scoreInt32Home team score.
home_team_conferenceStringHome team conference name.
home_team_conference_idInt32Home team conference id.
home_team_slugStringRelative stats.ncaa.org url for the home team.
home_team_divisionInt32Home team NCAA division (1, 2, 3).
away_teamStringAway team name.
away_team_idInt32Away team id.
away_team_scoreInt32Away team score.
away_team_conferenceStringAway team conference name.
away_team_conference_idInt32Away team conference id.
away_team_slugStringRelative stats.ncaa.org url for the away team.
away_team_divisionInt32Away team NCAA division (1, 2, 3).
neutral_siteStringNeutral-site venue (when not hosted by either team).
inningsInt32Innings played when other than regulation (extras).
slugStringURL-safe identifier.
game_info_urlStringFull stats.ncaa.org box-score url for the game.
contest_idInt32stats.ncaa.org contest (game) identifier.
load_ncaa_baseball_schedule(seasons=2023)