pybaseballdata.statcast package¶
Module contents¶
-
class
plyball.statcast.
StatCast
¶ Bases:
object
Statcast Data
-
static
batter
(start_dt=None, end_dt=None, player_id=None)¶ Pulls statcast batter-level data from Baseball Savant for a given batter. :param start_dt: :param end_dt: the final date for which you want data :param player_id:the player’s MLBAM ID. Find this by calling plyball.playerid_lookup(last_name, first_name), finding the correct player, and selecting their key_mlbam. :return:
-
large_request
(end_dt, d1, d2, step, verbose)¶ break start and end date into smaller increments, collecting all data in small chunks and appending all results to a common dataframe end_dt is the date strings for the final day of the query d1 and d2 are datetime objects for first and last day of query, for doing date math a third datetime object (d) will be used to increment over time for the several intermediate queries
- Parameters
end_dt –
d1 –
d2 –
step –
verbose –
- Returns
DataFrame
-
static
pitcher
(start_dt=None, end_dt=None, player_id=None)¶ Pulls statcast pitch-level data from Baseball Savant for a given batter.
- Parameters
start_dt – the first date for which you want a player’s sSatcast data
end_dt – the final date for which you want data
player_id – the player’s MLBAM ID.
- Returns
-
static
postprocessing
(data, team)¶ - Parameters
data – Statcast Data to Process
team – Team to Select
- Returns
DataFrame
-
static
single_game
(self, game_pk, team=None)¶ Pulls statcast play-level data from Baseball Savant for a single game, identified by its MLB game ID (game_pk in statcast data)
- Parameters
self –
game_pk – 6-digit integer MLB game ID to retrieve
team –
- Returns
DataFrame
-
static
single_game_request
(game_pk)¶ Select Single game for Statcast :param game_pk: :return:
-
static
small_request
(start_dt, end_dt)¶ - Parameters
start_dt –
end_dt –
- Returns
-
static
statcast
(self, start_dt=None, end_dt=None, team=None, verbose=True)¶ Pulls Statcast play-level data from Baseball Savant for a given date range. If no arguments are provided, this will return yesterday’s statcast data. If one date is provided, it will return that date’s Statcast data.
- Parameters
self –
start_dt – the first date for which you want statcast data
end_dt – the last date for which you want statcast data
team – [optional] city abbreviation of the team you want data for (e.g. SEA or BOS)
verbose –
- Returns
DataFrame
-
static