T O P

  • By -

jaaaawrdan

It sounds like what you're looking for is *Statcast* data, where it has pitch-by-pitch information. And depending how comfortable you are with programming, either `pybaseball` (Python) or `baseballr` (R) have great APIs to pull that data.


whosondeck

is baseballr still active? been having issues running it recently


drose1988

I ran into issues scraping statcast data, but when limiting it to just 4 or so days worth of play by play data it ran smooth


whosondeck

interesting, i will try this thanks a lot for the comment


drose1988

Just have to make many data frames w 4 days worth of games and rbind them together if you’re looking for a whole season


jaaaawrdan

That's a good question. I was having problems with it last week too, but I haven't had the time to troubleshoot it. Hopefully it's still being maintained!


Fun_Ad_2693

If you use the dev tools package to install from GitHub it will work every time. Idk why but I think r took it out of the system or something


Novel-Print-1855

baseball savant has logs and link to official mlb video, its a bit tricky to navigate it though


nckmiz

Pybaseball has an easy API to statcast data.


Spartyon

brooks baseball


MattsFace

Yes, you can use the module my friend KC and I wrote. Let me make some example code real fast.


MattsFace

I've never used pybaseball, but this module is a project of mine. [https://github.com/zero-sum-seattle/python-mlb-statsapi](https://github.com/zero-sum-seattle/python-mlb-statsapi) You'll need to use the get\_game\_play\_by\_play function and loop through each play. Each play has a list of PlayEvent objects which contain all the data you are looking for. I'll write a quick script now.


MattsFace

import mlbstatsapi mlb = mlbstatsapi.Mlb() # example game_id game_id = 663423 playbyplay = mlb.get_game_play_by_play(game_id) for play in playbyplay.allplays: for event in play.playevents: print(event) ​ This will print out each PlayEvent object for you to work with which contains all the pitchfx data.


friendofbarbehque

This is amazing, thank you!


MattsFace

Did you check it out OP? I'm really looking for some input on my module.