Skip to main content
Version: 0.1.5

MLB — additional Python functions — Baseball Savant (Statcast)

mlb_statcast_player​

mlb_statcast_player(player_id: 'int', stats: 'Optional[str]' = None, *, section: 'str' = 'statcast', raw: 'bool' = False, return_as_pandas: 'bool' = False, **kwargs: 'Any') -> "'Union[pl.DataFrame, pd.DataFrame, str]'"

GET /savant-player/{player_id} and parse one embedded table into a tidy frame.

Returns a tidy frame by default (the parsed Statcast page); pass raw=True to get the underlying HTML string instead (the page embeds ~12 other tables you can mine yourself, or feed to sportsdataverse.mlb.parse_mlb_statcast_player with a different section).

Parameters

ParameterTypeDefaultDescription
player_idintMLBAM player id (shared with the Stats API personId).
statsOptional[str]Noneoptional stats query value to scope the embedded payload.
sectionstr'statcast'which embedded serverVals table to flatten (default "statcast", the seasonal aggregate; e.g. "statcastGameLogs").
rawboolFalsereturn the raw page HTML string instead of a parsed frame.
return_as_pandasboolFalsereturn a pandas DataFrame instead of polars.

Returns

A polars (or pandas) DataFrame of the player's Statcast metrics by default (zero rows when the page/section is absent); the raw HTML str when raw=True.

col_nametypedescription
aggregateintegerAggregate.
yearintegerSeason year.
yearhiddenintegerYearhidden.
player_idintegerMLBAM player id.
ageintegerPlayer age.
bat_sidecharacterBatter side (R/L/S).
pitch_handcharacterPitcher handedness (R/L).
monthcharacterMonth.
grouping_codecharacterGrouping code.
grouping_catcharacterGrouping cat.
pitch_countintegerPitch count.
in_zone_percentnumericIn zone rate.
out_zone_percentnumericOut zone rate.
edge_percentnumericEdge rate.
z_swing_percentnumericZ swing rate.
oz_swing_percentnumericOz swing rate.
iz_contact_percentnumericIz contact rate.
oz_contact_percentnumericOz contact rate.
whiff_percentnumericWhiff rate (swings and misses / swings).
f_strike_percentnumericF strike rate.
f_swing_percentnumericF swing rate.
swing_percentnumericSwing rate.
meatball_swing_percentintegerMeatball swing rate.
meatball_percentnumericMeatball rate.
z_swing_miss_percentnumericZ swing miss rate.
oz_swing_miss_percentnumericOz swing miss rate.
in_zoneintegerIn zone.
out_zoneintegerOut zone.
edgeintegerEdge.
popupsintegerPopups.
flyballsintegerFlyballs.
linedrivesintegerLinedrives.
groundballsintegerGroundballs.
airballsintegerAirballs.
popups_percentnumericPopups rate.
flyballs_percentnumericFlyballs rate.
linedrives_percentnumericLinedrives rate.
groundballs_percentnumericGroundballs rate.
airballs_percentnumericAirballs rate.
pull_percentnumericPull rate.
straightaway_percentnumericStraightaway rate.
opposite_percentnumericOpposite rate.
pull_percent_airballsnumericPull percent airballs.
straightaway_percent_airballsnumericStraightaway percent airballs.
opposite_percent_airballsintegerOpposite percent airballs.
pull_percent_groundballsnumericPull percent groundballs.
straightaway_percent_groundballsnumericStraightaway percent groundballs.
opposite_percent_groundballsnumericOpposite percent groundballs.
pull_percent_popupsnumericPull percent popups.
straightaway_percent_popupsnumericStraightaway percent popups.
opposite_percent_popupsnumericOpposite percent popups.
pull_percent_flyballsnumericPull percent flyballs.
straightaway_percent_flyballsnumericStraightaway percent flyballs.
opposite_percent_flyballsnumericOpposite percent flyballs.
pull_percent_linedrivesintegerPull percent linedrives.
straightaway_percent_linedrivesintegerStraightaway percent linedrives.
opposite_percent_linedrivesintegerOpposite percent linedrives.
poorlyweak_percentintegerPoorlyweak rate.
poorlytopped_percentnumericPoorlytopped rate.
poorlyunder_percentnumericPoorlyunder rate.
flareburner_percentnumericFlareburner rate.
solidcontact_percentnumericSolidcontact rate.
hr_flyballs_percentnumericHr flyballs rate.
in_zone_swingintegerIn zone swing.
out_zone_swingintegerOut zone swing.
in_zone_swing_missintegerIn zone swing miss.
out_zone_swing_missintegerOut zone swing miss.
pitch_count_fastballintegerPitch count fastball.
pitch_count_offspeedintegerPitch count offspeed.
pitch_count_breakingintegerPitch count breaking.
paintegerPlate appearances.
abintegerAt-bats.
hitintegerHit.
singleintegerSingles.
doubleintegerDoubles.
tripleintegerTriples.
home_runintegerHome run.
walkintegerWalk.
strikeoutintegerStrikeout.
hbpintegerHbp.
k_percentnumericStrikeout rate.
bb_percentnumericWalk rate.
sz_judgenumericSz judge.
batted_ballintegerBatted ball.
barrelintegerBarrel.
barrel_batted_ratenumericBarrels per batted ball.
barrels_per_panumericBarrels per pa.
launch_angle_avgnumericLaunch angle avg.
exit_velocity_avgnumericExit velocity avg.
exit_velocity_maxnumericExit velocity max.
hard_hit_percentnumericHard-hit rate (95+ mph EV).
sweet_spot_percentnumericSweet-spot rate (8-32 deg launch angle).
banumericBatting average.
xbanumericExpected batting average.
baconnumericBacon.
xbaconnumericExpected batting average on contact.
babipnumericBABIP.
obpnumericOn-base percentage.
slgnumericSlugging percentage.
xobpnumericExpected on-base percentage.
xslgnumericExpected slugging.
isonumericIsolated power.
xisonumericExpected isolated power.
wobanumericWeighted on-base average.
xwobanumericExpected wOBA.
wobaconnumericWobacon.
xwobaconnumericXwobacon.
xbadiffnumericXbadiff.
xslgdiffnumericXslgdiff.
wobadiffnumericWobadiff.
player_typecharacterPlayer type.
eracharacterEra.
xeracharacterExpected ERA.
avg_hyper_speednumericAvg hyper speed.
avg_best_speednumericAvg best speed.
distance_hr_avgintegerDistance hr avg.
sprint_speednumericSprint speed (ft/sec, top 50% of competitive runs).
pop_2bcharacterPop 2b.
arm_cs_2bcharacterArm cs 2b.
strike_ratecharacterCalled-strike rate.
outs_above_averageintegerOuts Above Average.
jump_v_avgintegerJump v avg.
max_arm_strengthcharacterMax arm strength (mph).
arm_overallcharacterArm overall.
xhrnumericXhr.
swing_take_run_valueintegerSwing take run value.
blocks_above_averagecharacterBlocks above average.
cs_above_averagecharacterCs above average.
fastball_velocharacterFastball velo.
fastball_spincharacterFastball spin.
fastball_extensioncharacterFastball extension.
curveball_spincharacterCurveball spin.
pitch_run_value_fastballnumericPitch run value fastball.
pitch_run_value_breakingnumericPitch run value breaking.
pitch_run_value_offspeednumericPitch run value offspeed.
group_fastball_velonumericGroup fastball velo.
group_breaking_velonumericGroup breaking velo.
group_offspeed_velonumericGroup offspeed velo.
pitch_usage_fastballnumericPitch usage fastball.
pitch_usage_breakingnumericPitch usage breaking.
pitch_usage_offspeednumericPitch usage offspeed.
fielding_run_valueintegerFielding run value.
runner_run_valueintegerRunner run value.
fielding_run_value_armintegerFielding run value arm.
fielding_run_value_framingcharacterFielding run value framing.
runner_runs_sbintegerRunner runs sb.
runner_runs_xbintegerRunner runs xb.
net_bases_runnerintegerNet bases runner.
net_bases_pitchercharacterNet bases pitcher.
fast_swing_ratecharacterFast-swing rate (>=75 mph).
squared_up_contactcharacterSquared up contact.
squared_up_swingcharacterSquared up swing.
blasts_contactcharacterBlasts contact.
blasts_swingcharacterBlasts swing.
swordscharacterSwords.
avg_swing_speedcharacterAvg swing speed.
avg_swing_lengthcharacterAvg swing length.
attack_anglecharacterAttack angle (deg, bat path at contact).
vertical_swing_pathcharacterVertical swing path.
accelerationcharacterAcceleration.
horizontal_swing_pathcharacterHorizontal swing path.
attack_directioncharacterAttack direction (deg, pull/oppo).
ideal_angle_ratecharacterIdeal angle rate.
n_squared_upcharacterNumber of squared up.
n_blastscharacterNumber of blasts.
arm_anglecharacterArm angle.
is_qualifiedintegerIs qualified.
percent_rank_barrel_unroundedcharacterPercent rank barrel unrounded.
percent_rank_barrel_batted_rate_unroundedcharacterPercent rank barrel batted rate unrounded.
percent_rank_exit_velocity_avg_unroundedcharacterPercent rank exit velocity avg unrounded.
percent_rank_exit_velocity_max_unroundednumericPercent rank exit velocity max unrounded.
percent_rank_launch_angle_avg_unroundedcharacterPercent rank launch angle avg unrounded.
percent_rank_xba_unroundedcharacterPercent rank xba unrounded.
percent_rank_xslg_unroundedcharacterPercent rank xslg unrounded.
percent_rank_xwoba_unroundedcharacterPercent rank xwoba unrounded.
percent_rank_woba_unroundedcharacterPercent rank woba unrounded.
percent_rank_hard_hit_percent_unroundedcharacterPercent rank hard hit percent unrounded.
percent_rank_xwobacon_unroundedcharacterPercent rank xwobacon unrounded.
percent_rank_wobacon_unroundedcharacterPercent rank wobacon unrounded.
percent_rank_k_percent_unroundedcharacterPercent rank k percent unrounded.
percent_rank_bb_percent_unroundedcharacterPercent rank bb percent unrounded.
percent_rank_sz_judge_unroundedcharacterPercent rank sz judge unrounded.
percent_rank_whiff_percent_unroundedcharacterPercent rank whiff percent unrounded.
percent_rank_chase_percent_unroundedcharacterPercent rank chase percent unrounded.
percent_rank_ba_unroundedcharacterPercent rank ba unrounded.
percent_rank_bacon_unroundedcharacterPercent rank bacon unrounded.
percent_rank_xbacon_unroundedcharacterPercent rank xbacon unrounded.
percent_rank_babip_unroundedcharacterPercent rank babip unrounded.
percent_rank_obp_unroundedcharacterPercent rank obp unrounded.
percent_rank_slg_unroundedcharacterPercent rank slg unrounded.
percent_rank_xobp_unroundedcharacterPercent rank xobp unrounded.
percent_rank_iso_unroundedcharacterPercent rank iso unrounded.
percent_rank_xiso_unroundedcharacterPercent rank xiso unrounded.
percent_rank_sweet_spot_percent_unroundedcharacterPercent rank sweet spot percent unrounded.
percent_rank_distance_hr_avg_unroundedcharacterPercent rank distance hr avg unrounded.
percent_rank_groundballs_percent_unroundedcharacterPercent rank groundballs percent unrounded.
percent_rank_airballs_percent_unroundedcharacterPercent rank airballs percent unrounded.
percent_rank_avg_hyper_speed_unroundedcharacterPercent rank avg hyper speed unrounded.
percent_rank_avg_best_speed_unroundedcharacterPercent rank avg best speed unrounded.
percent_rank_pitch_run_value_fastball_unroundedcharacterPercent rank pitch run value fastball unrounded.
percent_rank_pitch_run_value_breaking_unroundedcharacterPercent rank pitch run value breaking unrounded.
percent_rank_pitch_run_value_offspeed_unroundedcharacterPercent rank pitch run value offspeed unrounded.
percent_rank_barrelcharacterPercent rank barrel.
percent_rank_barrel_batted_ratecharacterPercent rank barrel batted rate.
percent_rank_exit_velocity_avgcharacterPercent rank exit velocity avg.
percent_rank_exit_velocity_maxintegerPercent rank exit velocity max.
percent_rank_launch_angle_avgcharacterPercent rank launch angle avg.
percent_rank_xbacharacterPercent rank xba.
percent_rank_xslgcharacterPercent rank xslg.
percent_rank_xwobacharacterPercent rank xwoba.
percent_rank_wobacharacterPercent rank woba.
percent_rank_hard_hit_percentcharacterPercent rank hard hit rate.
percent_rank_xwobaconcharacterPercent rank xwobacon.
percent_rank_wobaconcharacterPercent rank wobacon.
percent_rank_k_percentcharacterPercent rank k rate.
percent_rank_bb_percentcharacterPercent rank bb rate.
percent_rank_sz_judgecharacterPercent rank sz judge.
percent_rank_whiff_percentcharacterPercent rank whiff rate.
percent_rank_chase_percentcharacterPercent rank chase rate.
percent_rank_bacharacterPercent rank ba.
percent_rank_baconcharacterPercent rank bacon.
percent_rank_xbaconcharacterPercent rank xbacon.
percent_rank_babipcharacterPercent rank babip.
percent_rank_obpcharacterPercent rank obp.
percent_rank_slgcharacterPercent rank slg.
percent_rank_xobpcharacterPercent rank xobp.
percent_rank_isocharacterPercent rank iso.
percent_rank_xisocharacterPercent rank xiso.
percent_rank_sweet_spot_percentcharacterPercent rank sweet spot rate.
percent_rank_distance_hr_avgcharacterPercent rank distance hr avg.
percent_rank_groundballs_percentcharacterPercent rank groundballs rate.
percent_rank_airballs_percentcharacterPercent rank airballs rate.
percent_rank_avg_hyper_speedcharacterPercent rank avg hyper speed.
percent_rank_avg_best_speedcharacterPercent rank avg best speed.
percent_rank_pitch_run_value_fastballcharacterPercent rank pitch run value fastball.
percent_rank_pitch_run_value_breakingcharacterPercent rank pitch run value breaking.
percent_rank_pitch_run_value_offspeedcharacterPercent rank pitch run value offspeed.
percent_speed_orderintegerPercent speed order.
percent_rank_speed_orderintegerPercent rank speed order.
percent_rank_pop_2bcharacterPercent rank pop 2b.
percent_rank_arm_cs_2bcharacterPercent rank arm cs 2b.
percent_rank_oaacharacterPercent rank oaa.
percent_rank_framingcharacterPercent rank framing.
percent_rank_jumpcharacterPercent rank jump.
percent_rank_fastball_velocharacterPercent rank fastball velo.
percent_rank_fastball_spincharacterPercent rank fastball spin.
percent_rank_fastball_extensioncharacterPercent rank fastball extension.
percent_rank_cu_spincharacterPercent rank cu spin.
percent_rank_xeracharacterPercent rank xera.
percent_rank_arm_maxcharacterPercent rank arm max.
percent_rank_arm_overallcharacterPercent rank arm overall.
percent_rank_xhrcharacterPercent rank xhr.
percent_rank_swing_take_run_valuecharacterPercent rank swing take run value.
percent_rank_blocks_above_averagecharacterPercent rank blocks above average.
percent_rank_cs_above_averagecharacterPercent rank cs above average.
percent_rank_fielding_run_valuecharacterPercent rank fielding run value.
percent_rank_runner_run_valuecharacterPercent rank runner run value.
percent_rank_fielding_run_value_armcharacterPercent rank fielding run value arm.
percent_rank_fielding_run_value_framingcharacterPercent rank fielding run value framing.
percent_rank_swing_speedcharacterPercent rank swing speed.
percent_rank_swing_lengthcharacterPercent rank swing length.
percent_rank_squared_up_swingcharacterPercent rank squared up swing.
percent_rank_attack_anglecharacterPercent rank attack angle.
percent_rank_vertical_swing_pathcharacterPercent rank vertical swing path.
percent_rank_accelerationcharacterPercent rank acceleration.
percent_rank_ideal_angle_ratecharacterPercent rank ideal angle rate.

Example

from sportsdataverse.mlb import mlb_statcast_player
df = mlb_statcast_player(592450)
html = mlb_statcast_player(592450, raw=True)

mlb_statcast_search(start_dt: 'str', end_dt: 'str', *, player_type: 'str' = 'batter', chunk_days: 'int' = 7, return_as_pandas: 'bool' = False, **filters: 'Any') -> "'Union[pl.DataFrame, pd.DataFrame]'"

Pitch-by-pitch MLB Statcast search (/statcast_search/csv), date-chunked.

Savant caps a single /statcast_search/csv response at 25,000 rows with no pagination. This splits the date range into chunk_days windows, halving any window that hits the cap, and stitches the chunks back together.

Parameters

ParameterTypeDefaultDescription
start_dtstr
end_dtstr
player_typestr'batter'"batter" (default) or "pitcher".
chunk_daysint7initial window size in days.
return_as_pandasboolFalsereturn a pandas DataFrame instead of polars.

Returns

A polars (or pandas) DataFrame, one row per pitch. A window with no games returns zero rows keeping the documented columns -- MLBAM ids Int64, the rest Null (no values to infer a dtype from), so the frame widens cleanly into a populated one.

col_nametypedescription
pitch_typecharacterAbbreviation of the pitch type thrown (e.g. FF, SL, CH).
game_datecharacterGame date (YYYY-MM-DD).
release_speeddoublePitch velocity out of the hand (mph).
release_pos_xdoubleHorizontal release position of the ball, catcher's perspective (feet).
release_pos_zdoubleVertical release position of the ball, catcher's perspective (feet).
player_namecharacterPlayer name.
batterintegerMLBAM player id of the batter.
pitcherintegerWhether the position is a pitcher.
eventscharacterNested list of non-game events.
descriptioncharacterLong-form description text.
spin_dirdoubleDeprecated spin direction field, no longer populated.
spin_rate_deprecateddoubleDeprecated legacy spin-rate field, no longer populated.
break_angle_deprecateddoubleDeprecated legacy break-angle field, no longer populated.
break_length_deprecateddoubleDeprecated legacy break-length field, no longer populated.
zonedoubleStrike-zone region the pitch crossed (1-14 Gameday zone).
descharacterFull text description of the play.
game_typecharacterGame type code (R, P, etc.).
standcharacterSide of the plate the batter is standing (L or R).
p_throwscharacterHand the pitcher throws with (L or R).
home_teamcharacterHome team name.
away_teamcharacterAway team name.
typecharacterRecord type / category.
hit_locationdoubleFielder position number that fielded the ball.
bb_typecharacterBatted-ball type (ground_ball, line_drive, fly_ball, popup).
ballsintegerBall count before the pitch.
strikesintegerStrike count before the pitch.
game_yearintegerSeason year of the game.
pfx_xdoubleHorizontal pitch movement from the catcher's perspective (feet).
pfx_zdoubleVertical pitch movement from the catcher's perspective (feet).
plate_xdoubleHorizontal position of the pitch crossing the plate (feet from center).
plate_zdoubleVertical position of the pitch crossing the plate (feet above ground).
on_3bintegerMLBAM ID of the runner on third base, if any.
on_2bintegerMLBAM ID of the runner on second base, if any.
on_1bintegerMLBAM ID of the runner on first base, if any.
outs_when_upintegerNumber of outs when the batter came to the plate.
inningintegerInning number.
inning_topbotcharacterHalf of the inning (Top or Bot).
hc_xdoubleHit coordinate X on the field diagram.
hc_ydoubleHit coordinate Y on the field diagram.
tfs_deprecateddoubleDeprecated time-from-start field, no longer populated.
tfs_zulu_deprecateddoubleDeprecated Zulu time-from-start field, no longer populated.
umpiredoubleDeprecated umpire field, no longer populated.
sv_iddoubleDeprecated Sportvision/Statcast pitch identifier, no longer populated.
vx0doubleVelocity of the pitch in the x-direction at y=50 ft (ft/s).
vy0doubleVelocity of the pitch in the y-direction at y=50 ft (ft/s).
vz0doubleVelocity of the pitch in the z-direction at y=50 ft (ft/s).
axdoubleAcceleration of the pitch in the x-direction at y=50 ft (ft/s^2).
aydoubleAcceleration of the pitch in the y-direction at y=50 ft (ft/s^2).
azdoubleAcceleration of the pitch in the z-direction at y=50 ft (ft/s^2).
sz_topdoubleTop of the batter's strike zone for the pitch (feet).
sz_botdoubleBottom of the batter's strike zone for the pitch (feet).
hit_distance_scdoubleStatcast-measured projected distance of the batted ball (feet).
launch_speeddoubleExit velocity of the batted ball (mph).
launch_angledoubleVertical launch angle of the batted ball (degrees).
effective_speeddoublePerceived velocity adjusted for release extension (mph).
release_spin_ratedoubleSpin rate of the pitch at release (rpm).
release_extensiondoubleDistance toward the plate at release (feet).
game_pkintegerUnique game identifier.
fielder_2integerMLBAM ID of the catcher.
fielder_3integerMLBAM ID of the first baseman.
fielder_4integerMLBAM ID of the second baseman.
fielder_5integerMLBAM ID of the third baseman.
fielder_6integerMLBAM ID of the shortstop.
fielder_7integerMLBAM ID of the left fielder.
fielder_8integerMLBAM ID of the center fielder.
fielder_9integerMLBAM ID of the right fielder.
release_pos_ydoubleRelease position of the ball toward the plate (feet).
estimated_ba_using_speedangledoubleExpected batting average based on exit velocity and launch angle.
estimated_woba_using_speedangledoubleExpected wOBA based on exit velocity and launch angle.
woba_valuedoublewOBA value assigned to the event.
woba_denomdoublewOBA denominator (plate-appearance weight) for the event.
babip_valuedoubleBABIP value assigned to the event (0 or 1).
iso_valuedoubleIsolated power value assigned to the event.
launch_speed_angledoubleBatted-ball classification code (1-6) from exit velocity and angle.
at_bat_numberintegerSequential plate-appearance number within the game.
pitch_numberintegerPitch number within the plate appearance.
pitch_namecharacterFull name of the pitch type (e.g. 4-Seam Fastball, Slider).
home_scoreintegerHome team run total after the play.
away_scoreintegerAway team run total after the play.
bat_scoreintegerBatting team score before the pitch.
fld_scoreintegerFielding team score before the pitch.
post_away_scoreintegerAway team score after the pitch.
post_home_scoreintegerHome team score after the pitch.
post_bat_scoreintegerBatting team score after the pitch.
post_fld_scoreintegerFielding team score after the pitch.
if_fielding_alignmentcharacterInfield defensive alignment (Standard, Strategic, Infield shift).
of_fielding_alignmentcharacterOutfield defensive alignment (Standard, Strategic, 4th outfielder).
spin_axisdoubleSpin axis of the pitch as a clock-face angle (degrees).
delta_home_win_expdoubleChange in home team win expectancy on the play.
delta_run_expdoubleChange in run expectancy on the play.
bat_speeddoubleBat speed at the point of contact (mph).
swing_lengthdoubleLength of the swing path to contact (feet).
miss_distancedoubleDistance between the bat and the ball on a swing-and-miss, in inches (Savant bat-tracking field); populated only on swinging-strike pitches and null on every other pitch.
estimated_slg_using_speedangledoubleExpected slugging based on exit velocity and launch angle.
delta_pitcher_run_expdoubleChange in run expectancy credited to the pitcher.
hyper_speeddoubleAdjusted (90th-percentile) exit velocity (mph).
home_score_diffintegerHome team score minus away team score before the pitch.
bat_score_diffintegerBatting team score minus fielding team score before the pitch.
home_win_expdoubleHome team win expectancy before the play.
bat_win_expdoubleBatting team win expectancy before the play.
age_pit_legacyintegerPitcher age using the legacy calculation.
age_bat_legacyintegerBatter age using the legacy calculation.
age_pitintegerPitcher age for the season.
age_batintegerBatter age for the season.
n_thruorder_pitcherintegerTimes through the order the pitcher is facing the lineup.
n_priorpa_thisgame_player_at_batintegerNumber of prior plate appearances by the batter in the game.
pitcher_days_since_prev_gamedoubleDays since the pitcher's previous game appearance.
batter_days_since_prev_gamedoubleDays since the batter's previous game appearance.
pitcher_days_until_next_gameintegerDays until the pitcher's next game appearance.
batter_days_until_next_gameintegerDays until the batter's next game appearance.
api_break_z_with_gravitydoubleVertical pitch break including gravity (inches).
api_break_x_armdoubleHorizontal pitch break to the pitcher's arm side (inches).
api_break_x_batter_indoubleHorizontal pitch break toward/away from the batter (inches).
arm_angledoublePitcher's arm angle at release (degrees).
attack_angledoubleAngle of the bat's path at contact (degrees).
attack_directiondoubleHorizontal direction of the swing at contact (degrees).
swing_path_tiltdoubleVertical tilt of the swing path (degrees).
intercept_ball_minus_batter_pos_x_inchesdoubleHorizontal offset of ball-bat intercept from batter position (inches).
intercept_ball_minus_batter_pos_y_inchesdoubleDepth offset of ball-bat intercept from batter position (inches).

Example

from sportsdataverse.mlb import mlb_statcast_search
df = mlb_statcast_search("2024-06-15", "2024-06-16", batters_lookup=592450)

mlb_statcast_search_minors​

mlb_statcast_search_minors(start_dt: 'str', end_dt: 'str', *, player_type: 'str' = 'batter', chunk_days: 'int' = 7, return_as_pandas: 'bool' = False, **filters: 'Any') -> "'Union[pl.DataFrame, pd.DataFrame]'"

Minor-league Statcast search (/statcast-search-minors/csv), date-chunked.

Same shape, columns, and 25,000-row chunking as mlb_statcast_search, against the MiLB CSV route with Savant's minors=true&wbc=false population flags sent for you (the route path alone returns MLB games). The route pins those two flags and overrides a minors=/wbc= passed through **filters; every other filter rides along. Narrow further with hfLevel ("AAA|", "AA|", "A+|", "A|") and hfSea filters.

Parameters

ParameterTypeDefaultDescription
start_dtstr
end_dtstr
player_typestr'batter'"batter" (default) or "pitcher".
chunk_daysint7initial window size in days.
return_as_pandasboolFalsereturn a pandas DataFrame instead of polars.

Returns

A polars (or pandas) DataFrame, one row per minor-league pitch. A window with no games returns zero rows keeping the documented columns -- MLBAM ids Int64, the rest Null (no values to infer a dtype from), so the frame widens cleanly into a populated one.

col_nametypedescription
pitch_typecharacterAbbreviation of the pitch type thrown (e.g. FF, SL, CH).
game_datecharacterGame date (YYYY-MM-DD).
release_speeddoublePitch velocity out of the hand (mph).
release_pos_xdoubleHorizontal release position of the ball, catcher's perspective (feet).
release_pos_zdoubleVertical release position of the ball, catcher's perspective (feet).
player_namecharacterPlayer name.
batterintegerMLBAM player id of the batter.
pitcherintegerWhether the position is a pitcher.
eventscharacterNested list of non-game events.
descriptioncharacterLong-form description text.
spin_dirdoubleDeprecated spin direction field, no longer populated.
spin_rate_deprecateddoubleDeprecated legacy spin-rate field, no longer populated.
break_angle_deprecateddoubleDeprecated legacy break-angle field, no longer populated.
break_length_deprecateddoubleDeprecated legacy break-length field, no longer populated.
zonedoubleStrike-zone region the pitch crossed (1-14 Gameday zone).
descharacterFull text description of the play.
game_typecharacterGame type code (R, P, etc.).
standcharacterSide of the plate the batter is standing (L or R).
p_throwscharacterHand the pitcher throws with (L or R).
home_teamcharacterHome team name.
away_teamcharacterAway team name.
typecharacterRecord type / category.
hit_locationdoubleFielder position number that fielded the ball.
bb_typecharacterBatted-ball type (ground_ball, line_drive, fly_ball, popup).
ballsintegerBall count before the pitch.
strikesintegerStrike count before the pitch.
game_yearintegerSeason year of the game.
pfx_xdoubleHorizontal pitch movement from the catcher's perspective (feet).
pfx_zdoubleVertical pitch movement from the catcher's perspective (feet).
plate_xdoubleHorizontal position of the pitch crossing the plate (feet from center).
plate_zdoubleVertical position of the pitch crossing the plate (feet above ground).
on_3bintegerMLBAM ID of the runner on third base, if any.
on_2bintegerMLBAM ID of the runner on second base, if any.
on_1bintegerMLBAM ID of the runner on first base, if any.
outs_when_upintegerNumber of outs when the batter came to the plate.
inningintegerInning number.
inning_topbotcharacterHalf of the inning (Top or Bot).
hc_xdoubleHit coordinate X on the field diagram.
hc_ydoubleHit coordinate Y on the field diagram.
tfs_deprecateddoubleDeprecated time-from-start field, no longer populated.
tfs_zulu_deprecateddoubleDeprecated Zulu time-from-start field, no longer populated.
umpiredoubleDeprecated umpire field, no longer populated.
sv_iddoubleDeprecated Sportvision/Statcast pitch identifier, no longer populated.
vx0doubleVelocity of the pitch in the x-direction at y=50 ft (ft/s).
vy0doubleVelocity of the pitch in the y-direction at y=50 ft (ft/s).
vz0doubleVelocity of the pitch in the z-direction at y=50 ft (ft/s).
axdoubleAcceleration of the pitch in the x-direction at y=50 ft (ft/s^2).
aydoubleAcceleration of the pitch in the y-direction at y=50 ft (ft/s^2).
azdoubleAcceleration of the pitch in the z-direction at y=50 ft (ft/s^2).
sz_topdoubleTop of the batter's strike zone for the pitch (feet).
sz_botdoubleBottom of the batter's strike zone for the pitch (feet).
hit_distance_scdoubleStatcast-measured projected distance of the batted ball (feet).
launch_speeddoubleExit velocity of the batted ball (mph).
launch_angledoubleVertical launch angle of the batted ball (degrees).
effective_speeddoublePerceived velocity adjusted for release extension (mph).
release_spin_ratedoubleSpin rate of the pitch at release (rpm).
release_extensiondoubleDistance toward the plate at release (feet).
game_pkintegerUnique game identifier.
fielder_2integerMLBAM ID of the catcher.
fielder_3integerMLBAM ID of the first baseman.
fielder_4integerMLBAM ID of the second baseman.
fielder_5integerMLBAM ID of the third baseman.
fielder_6integerMLBAM ID of the shortstop.
fielder_7integerMLBAM ID of the left fielder.
fielder_8integerMLBAM ID of the center fielder.
fielder_9integerMLBAM ID of the right fielder.
release_pos_ydoubleRelease position of the ball toward the plate (feet).
estimated_ba_using_speedangledoubleExpected batting average based on exit velocity and launch angle.
estimated_woba_using_speedangledoubleExpected wOBA based on exit velocity and launch angle.
woba_valuedoublewOBA value assigned to the event.
woba_denomdoublewOBA denominator (plate-appearance weight) for the event.
babip_valuedoubleBABIP value assigned to the event (0 or 1).
iso_valuedoubleIsolated power value assigned to the event.
launch_speed_angledoubleBatted-ball classification code (1-6) from exit velocity and angle.
at_bat_numberintegerSequential plate-appearance number within the game.
pitch_numberintegerPitch number within the plate appearance.
pitch_namecharacterFull name of the pitch type (e.g. 4-Seam Fastball, Slider).
home_scoreintegerHome team run total after the play.
away_scoreintegerAway team run total after the play.
bat_scoreintegerBatting team score before the pitch.
fld_scoreintegerFielding team score before the pitch.
post_away_scoreintegerAway team score after the pitch.
post_home_scoreintegerHome team score after the pitch.
post_bat_scoreintegerBatting team score after the pitch.
post_fld_scoreintegerFielding team score after the pitch.
if_fielding_alignmentcharacterInfield defensive alignment (Standard, Strategic, Infield shift).
of_fielding_alignmentcharacterOutfield defensive alignment (Standard, Strategic, 4th outfielder).
spin_axisdoubleSpin axis of the pitch as a clock-face angle (degrees).
delta_home_win_expdoubleChange in home team win expectancy on the play.
delta_run_expdoubleChange in run expectancy on the play.
bat_speeddoubleBat speed at the point of contact (mph).
swing_lengthdoubleLength of the swing path to contact (feet).
miss_distancedoubleDistance between the bat and the ball on a swing-and-miss, in inches (Savant bat-tracking field); null on pitches without a tracked swing-and-miss (about 90% of sampled rows).
estimated_slg_using_speedangledoubleExpected slugging based on exit velocity and launch angle.
delta_pitcher_run_expdoubleChange in run expectancy credited to the pitcher.
hyper_speeddoubleAdjusted (90th-percentile) exit velocity (mph).
home_score_diffintegerHome team score minus away team score before the pitch.
bat_score_diffintegerBatting team score minus fielding team score before the pitch.
home_win_expdoubleHome team win expectancy before the play.
bat_win_expdoubleBatting team win expectancy before the play.
age_pit_legacyintegerPitcher age using the legacy calculation.
age_bat_legacyintegerBatter age using the legacy calculation.
age_pitintegerPitcher age for the season.
age_batintegerBatter age for the season.
n_thruorder_pitcherintegerTimes through the order the pitcher is facing the lineup.
n_priorpa_thisgame_player_at_batintegerNumber of prior plate appearances by the batter in the game.
pitcher_days_since_prev_gamedoubleDays since the pitcher's previous game appearance.
batter_days_since_prev_gamedoubleDays since the batter's previous game appearance.
pitcher_days_until_next_gamedoubleDays until the pitcher's next game appearance.
batter_days_until_next_gamedoubleDays until the batter's next game appearance.
api_break_z_with_gravitydoubleVertical pitch break including gravity (inches).
api_break_x_armdoubleHorizontal pitch break to the pitcher's arm side (inches).
api_break_x_batter_indoubleHorizontal pitch break toward/away from the batter (inches).
arm_angledoublePitcher's arm angle at release (degrees).
attack_angledoubleAngle of the bat's path at contact (degrees).
attack_directiondoubleHorizontal direction of the swing at contact (degrees).
swing_path_tiltdoubleVertical tilt of the swing path (degrees).
intercept_ball_minus_batter_pos_x_inchesdoubleHorizontal offset of ball-bat intercept from batter position (inches).
intercept_ball_minus_batter_pos_y_inchesdoubleDepth offset of ball-bat intercept from batter position (inches).

Example

from sportsdataverse.mlb import mlb_statcast_search_minors
df = mlb_statcast_search_minors("2024-06-01", "2024-06-02")

mlb_statcast_search_wbc​

mlb_statcast_search_wbc(start_dt: 'str', end_dt: 'str', *, player_type: 'str' = 'batter', chunk_days: 'int' = 7, return_as_pandas: 'bool' = False, **filters: 'Any') -> "'Union[pl.DataFrame, pd.DataFrame]'"

World Baseball Classic Statcast search (/statcast-search-world-baseball-classic/csv).

Same shape, columns, and 25,000-row chunking as mlb_statcast_search, against the WBC CSV route with Savant's minors=false&wbc=true population flags sent for you (the route path alone returns MLB spring training). The route pins those two flags and overrides a minors=/wbc= passed through **filters; every other filter rides along. Pass WBC date windows (e.g. March of a WBC year); game_type is the tournament round (F pool play, D quarterfinals, L semifinals, W championship).

Parameters

ParameterTypeDefaultDescription
start_dtstr
end_dtstr
player_typestr'batter'"batter" (default) or "pitcher".
chunk_daysint7initial window size in days.
return_as_pandasboolFalsereturn a pandas DataFrame instead of polars.

Returns

A polars (or pandas) DataFrame, one row per WBC pitch. A window with no games returns zero rows keeping the documented columns -- MLBAM ids Int64, the rest Null (no values to infer a dtype from), so the frame widens cleanly into a populated one.

col_nametypedescription
pitch_typecharacterAbbreviation of the pitch type thrown (e.g. FF, SL, CH).
game_datecharacterGame date (YYYY-MM-DD).
release_speeddoublePitch velocity out of the hand (mph).
release_pos_xdoubleHorizontal release position of the ball, catcher's perspective (feet).
release_pos_zdoubleVertical release position of the ball, catcher's perspective (feet).
player_namecharacterPlayer name.
batterintegerMLBAM player id of the batter.
pitcherintegerWhether the position is a pitcher.
eventscharacterNested list of non-game events.
descriptioncharacterLong-form description text.
spin_dirdoubleDeprecated spin direction field, no longer populated.
spin_rate_deprecateddoubleDeprecated legacy spin-rate field, no longer populated.
break_angle_deprecateddoubleDeprecated legacy break-angle field, no longer populated.
break_length_deprecateddoubleDeprecated legacy break-length field, no longer populated.
zonedoubleStrike-zone region the pitch crossed (1-14 Gameday zone).
descharacterFull text description of the play.
game_typecharacterGame type code (R, P, etc.).
standcharacterSide of the plate the batter is standing (L or R).
p_throwscharacterHand the pitcher throws with (L or R).
home_teamcharacterHome team name.
away_teamcharacterAway team name.
typecharacterRecord type / category.
hit_locationdoubleFielder position number that fielded the ball.
bb_typecharacterBatted-ball type (ground_ball, line_drive, fly_ball, popup).
ballsintegerBall count before the pitch.
strikesintegerStrike count before the pitch.
game_yearintegerSeason year of the game.
pfx_xdoubleHorizontal pitch movement from the catcher's perspective (feet).
pfx_zdoubleVertical pitch movement from the catcher's perspective (feet).
plate_xdoubleHorizontal position of the pitch crossing the plate (feet from center).
plate_zdoubleVertical position of the pitch crossing the plate (feet above ground).
on_3bintegerMLBAM ID of the runner on third base, if any.
on_2bintegerMLBAM ID of the runner on second base, if any.
on_1bintegerMLBAM ID of the runner on first base, if any.
outs_when_upintegerNumber of outs when the batter came to the plate.
inningintegerInning number.
inning_topbotcharacterHalf of the inning (Top or Bot).
hc_xdoubleHit coordinate X on the field diagram.
hc_ydoubleHit coordinate Y on the field diagram.
tfs_deprecateddoubleDeprecated time-from-start field, no longer populated.
tfs_zulu_deprecateddoubleDeprecated Zulu time-from-start field, no longer populated.
umpiredoubleDeprecated umpire field, no longer populated.
sv_iddoubleDeprecated Sportvision/Statcast pitch identifier, no longer populated.
vx0doubleVelocity of the pitch in the x-direction at y=50 ft (ft/s).
vy0doubleVelocity of the pitch in the y-direction at y=50 ft (ft/s).
vz0doubleVelocity of the pitch in the z-direction at y=50 ft (ft/s).
axdoubleAcceleration of the pitch in the x-direction at y=50 ft (ft/s^2).
aydoubleAcceleration of the pitch in the y-direction at y=50 ft (ft/s^2).
azdoubleAcceleration of the pitch in the z-direction at y=50 ft (ft/s^2).
sz_topdoubleTop of the batter's strike zone for the pitch (feet).
sz_botdoubleBottom of the batter's strike zone for the pitch (feet).
hit_distance_scdoubleStatcast-measured projected distance of the batted ball (feet).
launch_speeddoubleExit velocity of the batted ball (mph).
launch_angledoubleVertical launch angle of the batted ball (degrees).
effective_speeddoublePerceived velocity adjusted for release extension (mph).
release_spin_ratedoubleSpin rate of the pitch at release (rpm).
release_extensiondoubleDistance toward the plate at release (feet).
game_pkintegerUnique game identifier.
fielder_2integerMLBAM ID of the catcher.
fielder_3integerMLBAM ID of the first baseman.
fielder_4integerMLBAM ID of the second baseman.
fielder_5integerMLBAM ID of the third baseman.
fielder_6integerMLBAM ID of the shortstop.
fielder_7integerMLBAM ID of the left fielder.
fielder_8integerMLBAM ID of the center fielder.
fielder_9integerMLBAM ID of the right fielder.
release_pos_ydoubleRelease position of the ball toward the plate (feet).
estimated_ba_using_speedangledoubleExpected batting average based on exit velocity and launch angle.
estimated_woba_using_speedangledoubleExpected wOBA based on exit velocity and launch angle.
woba_valuedoublewOBA value assigned to the event.
woba_denomdoublewOBA denominator (plate-appearance weight) for the event.
babip_valuedoubleBABIP value assigned to the event (0 or 1).
iso_valuedoubleIsolated power value assigned to the event.
launch_speed_angledoubleBatted-ball classification code (1-6) from exit velocity and angle.
at_bat_numberintegerSequential plate-appearance number within the game.
pitch_numberintegerPitch number within the plate appearance.
pitch_namecharacterFull name of the pitch type (e.g. 4-Seam Fastball, Slider).
home_scoreintegerHome team run total after the play.
away_scoreintegerAway team run total after the play.
bat_scoreintegerBatting team score before the pitch.
fld_scoreintegerFielding team score before the pitch.
post_away_scoreintegerAway team score after the pitch.
post_home_scoreintegerHome team score after the pitch.
post_bat_scoreintegerBatting team score after the pitch.
post_fld_scoreintegerFielding team score after the pitch.
if_fielding_alignmentcharacterInfield defensive alignment (Standard, Strategic, Infield shift).
of_fielding_alignmentcharacterOutfield defensive alignment (Standard, Strategic, 4th outfielder).
spin_axisdoubleSpin axis of the pitch as a clock-face angle (degrees).
delta_home_win_expdoubleChange in home team win expectancy on the play.
delta_run_expdoubleChange in run expectancy on the play.
bat_speeddoubleBat speed at the point of contact (mph).
swing_lengthdoubleLength of the swing path to contact (feet).
miss_distancedoubleDistance between the bat and the ball on a swing-and-miss, in inches (Savant bat-tracking field); all null in the sampled WBC pitches (2023-03-08), and coverage for later WBC tournaments is unverified.
estimated_slg_using_speedangledoubleExpected slugging based on exit velocity and launch angle.
delta_pitcher_run_expdoubleChange in run expectancy credited to the pitcher.
hyper_speeddoubleAdjusted (90th-percentile) exit velocity (mph).
home_score_diffintegerHome team score minus away team score before the pitch.
bat_score_diffintegerBatting team score minus fielding team score before the pitch.
home_win_expdoubleHome team win expectancy before the play.
bat_win_expdoubleBatting team win expectancy before the play.
age_pit_legacyintegerPitcher age using the legacy calculation.
age_bat_legacyintegerBatter age using the legacy calculation.
age_pitintegerPitcher age for the season.
age_batintegerBatter age for the season.
n_thruorder_pitcherintegerTimes through the order the pitcher is facing the lineup.
n_priorpa_thisgame_player_at_batintegerNumber of prior plate appearances by the batter in the game.
pitcher_days_since_prev_gamedoubleDays since the pitcher's previous game appearance.
batter_days_since_prev_gamedoubleDays since the batter's previous game appearance.
pitcher_days_until_next_gamedoubleDays until the pitcher's next game appearance.
batter_days_until_next_gamedoubleDays until the batter's next game appearance.
api_break_z_with_gravitydoubleVertical pitch break including gravity (inches).
api_break_x_armdoubleHorizontal pitch break to the pitcher's arm side (inches).
api_break_x_batter_indoubleHorizontal pitch break toward/away from the batter (inches).
arm_angledoublePitcher's arm angle at release (degrees).
attack_angledoubleAngle of the bat's path at contact (degrees).
attack_directiondoubleHorizontal direction of the swing at contact (degrees).
swing_path_tiltdoubleVertical tilt of the swing path (degrees).
intercept_ball_minus_batter_pos_x_inchesdoubleHorizontal offset of ball-bat intercept from batter position (inches).
intercept_ball_minus_batter_pos_y_inchesdoubleDepth offset of ball-bat intercept from batter position (inches).

Example

from sportsdataverse.mlb import mlb_statcast_search_wbc
df = mlb_statcast_search_wbc("2023-03-08", "2023-03-22")