pybaseballdata package¶
Subpackages¶
Submodules¶
pybaseballdata.league_batting_stats module¶
-
plyball.league_batting_stats.
batting_stats_bref
(season=None)¶ Get all batting stats for a set season. If no argument is supplied, gives stats for current season to date.
-
plyball.league_batting_stats.
batting_stats_range
(start_dt=None, end_dt=None)¶ Get all batting stats for a set time range. This can be the past week, the month of August, anything. Just supply the start and end date in YYYY-MM-DD format.
-
plyball.league_batting_stats.
bwar_bat
(return_all=False)¶ Get data from war_daily_bat table. Returns WAR, its components, and a few other useful stats. To get all fields from this table, supply argument return_all=True.
-
plyball.league_batting_stats.
get_soup
(start_dt, end_dt)¶
-
plyball.league_batting_stats.
get_table
(soup)¶
-
plyball.league_batting_stats.
sanitize_input
(start_dt, end_dt)¶
-
plyball.league_batting_stats.
validate_datestring
(date_text)¶
pybaseballdata.league_pitching_stats module¶
-
plyball.league_pitching_stats.
bwar_pitch
(return_all=False)¶ Get data from war_daily_pitch table. Returns WAR, its components, and a few other useful stats. To get all fields from this table, supply argument return_all=True.
-
plyball.league_pitching_stats.
get_soup
(start_dt, end_dt)¶
-
plyball.league_pitching_stats.
get_table
(soup)¶
-
plyball.league_pitching_stats.
pitching_stats_bref
(season=None)¶ Get all pitching stats for a set season. If no argument is supplied, gives stats for current season to date.
-
plyball.league_pitching_stats.
pitching_stats_range
(start_dt=None, end_dt=None)¶ Get all pitching stats for a set time range. This can be the past week, the month of August, anything. Just supply the start and end date in YYYY-MM-DD format.
-
plyball.league_pitching_stats.
sanitize_input
(start_dt, end_dt)¶
-
plyball.league_pitching_stats.
validate_datestring
(date_text)¶
pybaseballdata.playerid_lookup module¶
-
plyball.playerid_lookup.
get_lookup_table
()¶
-
plyball.playerid_lookup.
playerid_lookup
(last, first=None)¶
-
plyball.playerid_lookup.
playerid_reverse_lookup
(player_ids, key_type=None)¶ Retrieve a table of player information given a list of player ids
- Parameters
player_ids (list) – list of player ids
key_type (str) – name of the key type being looked up (one of “mlbam”, “retro”, “bbref”, or “fangraphs”)
- Return type
pandas.core.frame.DataFrame
pybaseballdata.standings module¶
-
plyball.standings.
get_soup
(year)¶
-
plyball.standings.
get_tables
(soup, season)¶
-
plyball.standings.
standings
(season=None)¶
pybaseballdata.team_results module¶
-
plyball.team_results.
get_soup
(season, team)¶
-
plyball.team_results.
get_table
(soup, team)¶
-
plyball.team_results.
make_numeric
(data)¶
-
plyball.team_results.
process_win_streak
(data)¶ Convert “+++”/”—” formatted win/loss streak column into a +/- integer column
-
plyball.team_results.
schedule_and_record
(season=None, team=None)¶
pybaseballdata.utils module¶
-
plyball.utils.
get_zip_file
(url)¶ Get zip file from provided URL
-
plyball.utils.
sanitize_input
(start_dt, end_dt, player_id)¶
-
plyball.utils.
split_request
(start_dt, end_dt, player_id, url)¶ Splits Statcast queries to avoid request timeouts
-
plyball.utils.
validate_datestring
(date_text)¶