Skip to content
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

pitching_stats(year) not working for some seasons #410

Open
pyradical opened this issue Mar 28, 2024 · 2 comments
Open

pitching_stats(year) not working for some seasons #410

pyradical opened this issue Mar 28, 2024 · 2 comments

Comments

@pyradical
Copy link

I'll get an empty dataframe returned for 2013, 2014, and 2016 (print player_series). I'm relatively new to baseball and pybaseball, so I double checked that he played in those years and he most certainly did.

`gerrit_cole = pb.playerid_lookup('cole', 'gerrit')
gerrit_fg = gerrit_cole.iloc[0]['key_fangraphs']

first_season = int(gerrit_cole.iloc[0]['mlb_played_first'])
last_season = int(gerrit_cole.iloc[0]['mlb_played_last']) + 1

season_range = range(first_season, last_season)

columns = ['ERA-']
cole_df = pd.DataFrame(columns= columns)
for year in season_range:
print(year)
season_df = pb.pitching_stats(year)
player_series = season_df[season_df['Name'] == 'Gerrit Cole']
print(player_series)
`

Is there something I'm doing incorrectly here?

@lplabuskes
Copy link

By default, pitching_stats will apply the FanGraphs requirement for "qualified" pitchers, 1 IP per team game played. Gerrit Cole didn't have the innings pitched to meet that threshold in 2013, 2014, or 2016. You can set your own IP threshold with the argument qual=<your threshold here>, though this can slow things down a lot.

There's also a completely undocumented argument to only look up data for particular players. So, for example
pb.pitching_stats(start_season=1900, end_season=2024, split_seasons=True, players="13125,19361", qual=0)
Gives every season of either Gerrit Cole (13125) or Corbin Burnes (19361)

@bclark08
Copy link

There's also a completely undocumented argument to only look up data for particular players. So, for example pb.pitching_stats(start_season=1900, end_season=2024, split_seasons=True, players="13125,19361", qual=0) Gives every season of either Gerrit Cole (13125) or Corbin Burnes (19361)

Thank you...so much for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants