Statcast_Pitcher only working for selective players in 2017 season
Closed this issue · 2 comments
I am currently working on a project in which i want to compare Aaron Judge and David Ortiz. However, while I am able to look-up both players and get their corresponding key_mlbam, the statcast_pitcher function returns an empty data frame for both. However, using the example from your readme.md, I am able to get the key_mlbam and corresponding stats for Clayton Kershaw. Below is my code:
Install Missing Packages
#!pip install pybaseball
Load Libraries
from pybaseball import statcast, playerid_lookup, statcast_pitcher
Load Data
Get statcast data
statcast(start_dt="2017-04-02", end_dt="2017-09-30").columns
Look-up Aaron Judge Stats
playerid_lookup('Judge', 'Aaron')
judge_stats = statcast_pitcher('2017-04-02', '2017-09-30', 592450)
judge_stats
Look-up David Ortiz Stats
ortiz_stats = statcast_pitcher('2017-04-02', '2017-09-30', playerid_lookup('ortiz', 'david').key_mlbam.iloc[0])
ortiz_stats
Look-up Clayton Kershaw Stats
playerid_lookup('kershaw', 'clayton')
kershaw_stats = statcast_pitcher('2017-04-02', '2017-09-30', 477132)
kershaw_stats
Thank you in advance for looking into the issue!
You can try to change the function name from statcast_pitcher
to statcast_batter
because statcast_pitcher
only return player's data if they have pitching performance.
Judge and Ortiz never pitched before therefore it will not have any time return from statcast_pitcher
FYI, these functions are based on Savant's Search page. Maybe you could also have a try
https://baseballsavant.mlb.com/statcast_search
@ss77995ss that did the trick! Thank you so much for your help!