Guides
Baseball data, one question at a time
Working Python, JavaScript and cURL for common baseball data questions, each run against the live API with the real response shown.
Where do I get MLB pitch-by-pitch data for a model?
Every pitch a pitcher threw, with count, type, velocity, location and result, loaded into pandas with a swinging-strike label ready for a classifier.
get_pitches · 10 credits
How do I get a pitcher's pitch mix and whiff rate in Python?
A pitcher's arsenal for a season: how often each pitch is thrown, how hard, and how often it draws a swing and a miss.
get_pitch_mix · 5 credits
How do I build an MLB spray chart in Python?
Where a hitter puts the ball in play, by trajectory and field, plus the x and y of every ball in play if you want to draw it.
get_spray_chart · 10 credits
How do I find MLB teams that over- or underperformed their run differential?
Standings from every final game, with run differential and the Pythagorean win percentage, so you can see who won more or fewer games than their runs say.
get_standings · 2 credits
How do I measure a hitter's run value with runners in scoring position?
Every plate appearance with a runner on second or third, with the base-out state before it, the result, and the run value it added or cost.
get_plate_appearances · 10 credits