-
-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The roster for team #142
Comments
You can fetch the unformatted data the same way |
Thank you so much @toddrob99. I much appreciated your response! So the exercise I am working on is to find the team Id / team name based on the pitcher Id (from every pitch) to analyze the pitcher performance. Since I can't find any function to get team Id from pitcher Id, the path I am going is to use the pitcher Id from a specific game -> pitcher first name, last name -> look up the name from team roster of all time (lots of data to aggregate) -> find the team(s) has this pitch name or pitcher Id. Is there any better way to do this? |
Where are you getting the pitch data from? If it's from the game endpoint, the team information is in there too. If you truly have pitch data with a pitcher id but no team info, you can look up the player from the pitcher id using the person endpoint and statsapi.get(). If I were analyzing all pitches from all games in a given season, I would start with the schedule endpoint to get a list of gamePks, then loop through the game endpoint for each gamePk and collect the team, pitcher, and pitch data from there. |
Thanks again @toddrob99. I tried the team_roster but couldn't get the right data yet. Still working on it. For example,
|
By the way, for your question about pitch data, I got it from https://github.com/jldbc/pybaseball. It contains detail pitching data around every pitch since 2018. I thought analyzing the pitching style/speed by team over time could be valuable information. This pybaseball data does have gamePk. |
It seems like the API doesn't have roster data for minor league teams, because if I change the teamId to 143 (Philadelphia Phillies) it does return the roster data. https://statsapi.mlb.com/api/v1/teams/4104/roster?rosterType=fullRoster&season=2018 |
I am looking for the team roster information and found the statsapi.roster() is very helpful. However, it returns a string which I have to parse and might have some level of errors i.e. if one has middle name, etc. Would it be better to return a list - it seems having the list format in the string.
In addition, it would be really great to also return the player Id as well.
Thank you for creating this statsapi!
The text was updated successfully, but these errors were encountered: