MLB — additional Python functions — ESPN
espn_mlb_calendar
espn_mlb_calendar(season=None, ondays=None, return_as_pandas=False, **kwargs) -> 'pl.DataFrame'
espn_mlb_calendar - look up the MLB game-day calendar for a season.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
season | int | None | Season year (e.g. 2024). |
ondays | bool | None | When True, returns the date-only list ESPN exposes; when False, returns a one-row-per-date frame with eventDate plus parsed year/month/day. |
return_as_pandas | bool | False | If True, returns a pandas dataframe. |
Returns
Polars dataframe of valid game dates.
| col_name | type | description |
|---|---|---|
event_date | String | Event date-time in ISO 8601 (e.g. '2017-07-11T00:00:00Z'). |
year | Int64 | Season (4-digit year). |
month | Int64 | Month of the game day, as an integer (1-12). |
day | Int64 | Day of the month of the game day, as an integer. |
season | Int64 | Season year. |
Example
from sportsdataverse.mlb import espn_mlb_calendar
cal = espn_mlb_calendar(season=2024)
print(cal.shape)
cal.head()
espn_mlb_game_rosters
espn_mlb_game_rosters(game_id: 'int', raw: 'bool' = False, return_as_pandas: 'bool' = False, **kwargs)
espn_mlb_game_rosters - pull the active game rosters for both teams.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
game_id | int | ESPN game id. | |
raw | bool | False | When True, returns {"competitors": [...], "rows": [...]}: the competitor items and one dict per roster entry with the documented columns, read from the entry only (no athlete fetch; athlete_id is the entry's playerId, else the id in its athlete $ref; it and game_position_id are ints). |
return_as_pandas | bool | False | When True, returns a pandas dataframe; otherwise polars. |
Returns
One row per (game × team × athlete) with columns game_id, team_id, home_away, athlete_id, athlete_full_name, athlete_jersey, athlete_position_id, athlete_position_abbreviation, athlete_position_name, game_position_id, athlete_starter; zero rows with those columns when ESPN lists no competitor roster entry.
| col_name | type | description |
|---|---|---|
game_id | Int64 | ESPN game (event) id the roster belongs to. |
team_id | Int64 | ESPN team id of the competitor whose roster the row comes from. |
home_away | String | Whether the row's team is the home or the away side of the game ("home" / "away"). |
athlete_id | Int64 | ESPN athlete id, from the roster entry's playerId (else the id in its athlete $ref). |
athlete_full_name | String | The athlete's full name, from his ESPN athlete record (the roster entry carries only a short name). |
athlete_jersey | String | The athlete's jersey number as text, from his ESPN athlete record. |
athlete_position_id | Int64 | ESPN position id of the athlete's listed position on his athlete record, i.e. his season position, not necessarily where he played in this game (see game_position_id). |
athlete_position_abbreviation | String | Abbreviation of the athlete's listed (season) position on his athlete record, e.g. RF or SS. |
athlete_position_name | String | Name of the athlete's listed (season) position on his athlete record, e.g. Right Field. |
game_position_id | Int64 | ESPN position id the player entered this game at, from the roster entry's own position $ref (e.g. 8 for a center fielder; 11 is a pinch hitter and 12 a pinch runner). It is the entry position only, not any later move in the game; differs from athlete_position_id when he played out of his listed position. |
athlete_starter | Boolean | Whether the athlete started this game, from the roster entry. |
Raises
| Exception | Description |
|---|---|
AssetFetchError | A competitors, roster or athlete fetch failed (not a 404). |
NoDataError | The competitors resource answered 404, or roster entries exist but no athlete record could be read (every athlete $ref 404'd, or no entry carries one). |
Example
from sportsdataverse.mlb import espn_mlb_game_rosters
ros = espn_mlb_game_rosters(game_id=401569461)
print(ros.shape)
ros.group_by("home_away").len()
espn_mlb_pbp
espn_mlb_pbp(game_id: 'int', raw: 'bool' = False, **kwargs) -> 'Dict'
espn_mlb_pbp - pull the full ESPN game-summary payload for one MLB game.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
game_id | int | ESPN game id (the "event id"). Obtainable from espn_mlb_schedule. | |
raw | bool | False | When True, returns the full nested payload unchanged. When False (default), the same payload is returned for now — full parsing into a tidy plays / boxscore dict is not yet implemented; see the TODO below. |
Returns
The Site v2 summary payload. Top-level keys typically include header, boxscore, plays, leaders, scoringPlays, gameInfo, winprobability, pickcenter, news, videos, standings, article, seasonseries, broadcasts, predictor.
Example
from sportsdataverse.mlb import espn_mlb_pbp
game = espn_mlb_pbp(game_id=401569461, raw=True)
sorted(game.keys())
print(game.get("header", {}).get("competitions", [{}])[0].get("date"))
# Iterate the plays array
plays = game.get("plays") or []
print(f"{len(plays)} plays")
for p in plays[:3]:
print(p.get("text"))
espn_mlb_player_box
espn_mlb_player_box(game_id: 'int | str', return_as_pandas: 'bool' = False, **kwargs: 'Any') -> 'pl.DataFrame | pd.DataFrame'
Pull one MLB game's player box score from ESPN's summary endpoint.
The baseballr table of the same name (baseballr::espn_mlb_player_box): one row per athlete
and side, batters then pitchers for the first team listed, then the second team. One request.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
game_id | int | str | ESPN game (event) id, from espn_mlb_schedule or espn_mlb_scoreboard. | |
return_as_pandas | bool | False | Return a pandas frame instead of polars (pyarrow-backed columns, so the nullable ids stay integers). |
Returns
The game header, stat_group (batting or pitching), the team and athlete identity, starter, bat_order and active, then ESPN's box-score columns as text: h_ab, ab, r, h, rbi, hr, bb, k, number_p, avg, obp, slg for batters and ip, er, pc_st, era, pc for pitchers (a pitcher's h / r / bb / k / hr are the ones he allowed). A two-way player has one row per side. A zero-row frame with the documented columns when ESPN lists no athletes for the game.
| col_name | type | description |
|---|---|---|
game_id | Int64 | ESPN game (event) id. |
season | Int32 | Season (four-digit year) of the game, from the summary header. |
season_type | Int32 | ESPN season type of the game: 1 preseason, 2 regular season, 3 postseason (MLB); ESPN files the college postseason under other types (the 2024 Men's College World Series final is 6). |
game_date | Date | US/Eastern calendar date of the scheduled first pitch. |
game_date_time | Datetime | Scheduled first pitch, US/Eastern. |
stat_group | String | Which side of the box score the row reports: batting or pitching. A two-way player has one row for each. |
team_id | Int64 | ESPN team id of the athlete's team. |
team_name | String | Team nickname, e.g. Cardinals. |
team_abbreviation | String | Team abbreviation, e.g. STL. |
team_display_name | String | Full team name, e.g. St. Louis Cardinals. |
athlete_id | Int64 | ESPN athlete id of the player the row reports. |
athlete_display_name | String | Athlete's full name. |
athlete_short_name | String | Athlete's short name, e.g. N. Arenado. |
athlete_position_name | String | Position the athlete played in the game, e.g. Third Base or Pitcher. |
athlete_position_abbreviation | String | Abbreviation of the position the athlete played, e.g. 3B or P. |
starter | Boolean | True when the athlete started the game (on the batting side, was in the starting lineup). |
bat_order | Int32 | Spot in the batting order, 1-9; a substitute takes the spot of the player he replaced. Null on pitching rows. |
active | Boolean | ESPN's active flag for the athlete's box-score entry. |
h_ab | String | Batting: hits and at-bats as text, e.g. 2-4. |
ab | String | Batting: at-bats. |
r | String | Runs: scored by the batter on a batting row, allowed by the pitcher on a pitching row. |
h | String | Hits: by the batter on a batting row, allowed by the pitcher on a pitching row. |
rbi | String | Batting: runs batted in. |
hr | String | Home runs: hit by the batter on a batting row, allowed by the pitcher on a pitching row. |
bb | String | Walks: drawn by the batter on a batting row, issued by the pitcher on a pitching row. |
k | String | Strikeouts: by the batter on a batting row, by the pitcher on a pitching row. |
number_p | String | Batting: pitches the batter saw (ESPN's #P). |
avg | String | Batting: the batter's season batting average through the game, ESPN's display text (e.g. .286). |
obp | String | Batting: the batter's season on-base percentage through the game. |
slg | String | Batting: the batter's season slugging percentage through the game. |
ip | String | Pitching: innings pitched, in ESPN's thirds notation (6.1 = six and one third). |
er | String | Pitching: earned runs allowed. |
pc_st | String | Pitching: pitches and strikes thrown, e.g. 95-58. |
era | String | Pitching: the pitcher's season ERA through the game. |
pc | String | Pitching: pitches thrown. |
Raises
| Exception | Description |
|---|---|
NoDataError | ESPN answered 404 for the game. |
AssetFetchError | The request failed (a non-2xx answer or a connection failure after retries). |
Example
from sportsdataverse.mlb import espn_mlb_player_box
player_box = espn_mlb_player_box(game_id=401569534)
print(player_box.shape)
# Pipeline next step (one line)
import polars as pl
player_box.filter(pl.col("stat_group") == "pitching").select("athlete_display_name", "ip", "k")
espn_mlb_player_stats
espn_mlb_player_stats(athlete_id: 'int', season: 'int', *, season_type: 'str' = 'regular', total: 'bool' = False, raw: 'bool' = False, return_as_pandas: 'bool' = False, **kwargs: 'Any') -> 'pl.DataFrame | pd.DataFrame | dict[str, Any]'
Pull an MLB athlete's ESPN season stat line as one wide row.
See sportsdataverse.wbb.espn_wbb_player_stats for full
documentation of the wide return shape, the {category}_{stat} stat
columns (for baseball: batting_*, pitching_*, fielding_*),
the athlete / team metadata blocks, and the season_type / total
parameters. For the richer multi-category web-v3 payload use
sportsdataverse.mlb.espn_mlb_player_stats_v3.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
athlete_id | int | ESPN MLB athlete identifier (e.g. 33192 for Aaron Judge). | |
season | int | Season year, used in the core-v2 path. | |
season_type | str | 'regular' | "regular" (type 2) or "postseason" (type 3). |
total | bool | False | Forward-compat totals passthrough. |
raw | bool | False | If True, returns the raw core-v2 statistics JSON dict. |
return_as_pandas | bool | False | If True, returns a pandas DataFrame; else polars. |
Returns
A single-row wide DataFrame (polars by default). When raw=True returns the raw statistics JSON dict.
| col_name | type | description |
|---|---|---|
season | Int64 | Season year. |
season_type | String | Season-type id. |
total | Boolean | Total. |
athlete_id | Int64 | Unique ESPN athlete identifier. |
athlete_uid | String | Athlete uid. |
athlete_guid | String | Athlete guid. |
athlete_type | String | Athlete type. |
first_name | String | Player first name. |
last_name | String | Player last name. |
full_name | String | Player's full name. |
display_name | String | Display name. |
short_name | String | Short display name. |
weight | Float64 | Weight in pounds. |
display_weight | String | Display weight. |
height | Float64 | Height (feet and inches). |
display_height | String | Display height. |
age | Int64 | Player age (in years). |
date_of_birth | String | Date of birth. |
jersey | String | Jersey number worn by the player. |
slug | String | URL-safe identifier. |
active | Boolean | Whether the player is currently active. |
position_id | Int64 | Unique position identifier. |
position_name | String | Position name. |
position_display_name | String | Position display name. |
position_abbreviation | String | Position abbreviation. |
college_name | String | |
status_id | Int64 | Status id. |
status_name | String | Game status (e.g. 'STATUS_FINAL'). |
batting_games_played | Float64 | Team batting: batting games played. |
batting_team_games_played | Float64 | Team batting: batting team games played. |
batting_hit_by_pitch | Float64 | Team batting: batting hit by pitch. |
batting_ground_balls | Float64 | Team batting: batting ground balls. |
batting_strikeouts | Float64 | Team batting: batting strikeouts. |
batting_rb_is | Float64 | Team batting: batting rb is. |
batting_sac_hits | Float64 | Team batting: batting sac hits. |
batting_hits | Float64 | Team batting: batting hits. |
batting_stolen_bases | Float64 | Team batting: batting stolen bases. |
batting_walks | Float64 | Team batting: batting walks. |
batting_catcher_interference | Float64 | Team batting: batting catcher interference. |
batting_runs | Float64 | Team batting: batting runs. |
batting_gid_ps | Float64 | Team batting: batting gid ps. |
batting_sac_flies | Float64 | Team batting: batting sac flies. |
batting_at_bats | Float64 | Team batting: batting at bats. |
batting_home_runs | Float64 | Team batting: batting home runs. |
batting_grand_slam_home_runs | Float64 | Team batting: batting grand slam home runs. |
batting_runners_left_on_base | Float64 | Team batting: batting runners left on base. |
batting_triples | Float64 | Team batting: batting triples. |
batting_game_winning_rb_is | Float64 | Team batting: batting game winning rb is. |
batting_intentional_walks | Float64 | Team batting: batting intentional walks. |
batting_doubles | Float64 | Team batting: batting doubles. |
batting_fly_balls | Float64 | Team batting: batting fly balls. |
batting_caught_stealing | Float64 | Team batting: batting caught stealing. |
batting_pitches | Float64 | Team batting: batting pitches. |
batting_games_started | Float64 | Team batting: batting games started. |
batting_pinch_at_bats | Float64 | Team batting: batting pinch at bats. |
batting_pinch_hits | Float64 | Team batting: batting pinch hits. |
batting_player_rating | Float64 | Team batting: batting player rating. |
batting_is_qualified | Float64 | Team batting: batting is qualified. |
batting_is_qualified_steals | Float64 | Team batting: batting is qualified steals. |
batting_total_bases | Float64 | Team batting: batting total bases. |
batting_plate_appearances | Float64 | Team batting: batting plate appearances. |
batting_projected_home_runs | Float64 | Team batting: batting projected home runs. |
batting_extra_base_hits | Float64 | Team batting: batting extra base hits. |
batting_runs_created | Float64 | Team batting: batting runs created. |
batting_avg | Float64 | Team batting: batting average. |
batting_pinch_avg | Float64 | Team batting: batting pinch avg. |
batting_slug_avg | Float64 | Team batting: batting slug avg. |
batting_secondary_avg | Float64 | Team batting: batting secondary avg. |
batting_on_base_pct | Float64 | Team batting: batting on base pct. |
batting_ops | Float64 | Team batting: batting ops. |
batting_ground_to_fly_ratio | Float64 | Team batting: batting ground to fly ratio. |
batting_runs_created_per27_outs | Float64 | Bill James Runs Created per 27 outs, estimating how many runs a lineup of this batter would score per game. |
batting_batter_rating | Float64 | Team batting: batting batter rating. |
batting_at_bats_per_home_run | Float64 | Team batting: batting at bats per home run. |
batting_stolen_base_pct | Float64 | Team batting: batting stolen base pct. |
batting_pitches_per_plate_appearance | Float64 | Team batting: batting pitches per plate appearance. |
batting_isolated_power | Float64 | Team batting: batting isolated power. |
batting_walk_to_strikeout_ratio | Float64 | Team batting: batting walk to strikeout ratio. |
batting_walks_per_plate_appearance | Float64 | Team batting: batting walks per plate appearance. |
batting_secondary_avg_minus_ba | Float64 | Team batting: batting secondary avg minus ba. |
batting_runs_produced | Float64 | Team batting: batting runs produced. |
batting_runs_ratio | Float64 | Team batting: batting runs ratio. |
batting_patience_ratio | Float64 | Ratio of walks to strikeouts, measuring a batter's plate discipline and ability to work counts. |
batting_bipa | Float64 | Batting average on balls in the air (fly balls and line drives), measuring in-play success on airborne contact. |
batting_mlb_rating | Float64 | ESPN's composite MLB rating for the batter reflecting overall offensive performance. |
batting_off_warbr | Float64 | Offensive Wins Above Replacement (Baseball Reference methodology) attributable to the batter's hitting contributions. |
batting_warbr | Float64 | Total Wins Above Replacement (Baseball Reference methodology) for the batter including offense and baserunning. |
fielding_games_played | Float64 | Number of games in which the player appeared defensively at their position. |
fielding_team_games_played | Float64 | Number of games the player's team played while the player was on the active roster. |
fielding_double_plays | Float64 | Number of double plays the fielder participated in during the season. |
fielding_opportunities | Float64 | Total fielding opportunities defined as putouts plus assists plus errors for the player. |
fielding_errors | Float64 | Number of fielding errors charged to the player during the season. |
fielding_passed_balls | Float64 | Number of pitches ruled as passed balls charged to the catcher during the season. |
fielding_assists | Float64 | Number of assists recorded by the fielder when a thrown ball contributes to an out. |
fielding_outfield_assists | Float64 | Number of outfield assists, recorded when an outfielder throws out a runner. |
fielding_pickoffs | Float64 | Number of baserunners picked off by pitchers while this catcher was behind the plate or this fielder was at their position. |
fielding_putouts | Float64 | Number of putouts recorded by the fielder where they made the final play to retire a batter or runner. |
fielding_outs_on_field | Float64 | Total outs recorded across all innings the player was present on the field. |
fielding_triple_plays | Float64 | Number of triple plays in which the fielder participated during the season. |
fielding_balls_in_zone | Float64 | Number of batted balls that entered the fielder's defined defensive zone. |
fielding_extra_bases | Float64 | Extra bases allowed by the outfielder due to errors or misplays on balls hit into their zone. |
fielding_outs_made | Float64 | Total outs the fielder was directly responsible for recording during the season. |
fielding_hits | Float64 | Number of hits recorded while this fielder was positioned, relevant for zone-rating calculations. |
fielding_total_bases | Float64 | Total bases allowed by the outfielder on balls hit into their zone, used in advanced defensive metrics. |
fielding_games_started | Float64 | Number of games the player started at their primary defensive position. |
fielding_catcher_third_innings_played | Float64 | Total one-third innings played behind the plate by the catcher, expressed in thirds. |
fielding_catcher_caught_stealing | Float64 | Number of opposing baserunners thrown out attempting to steal a base by this catcher. |
fielding_catcher_stolen_bases_allowed | Float64 | Number of successful stolen bases allowed by the catcher during the season. |
fielding_catcher_earned_runs | Float64 | Earned runs allowed while this catcher was behind the plate, used in catcher ERA calculations. |
fielding_is_qualified | Float64 | Indicator flag for whether the player meets minimum innings requirements to qualify for fielding rate stats. |
fielding_is_qualified_catcher | Float64 | Indicator flag for whether the catcher meets the minimum innings threshold to qualify for catcher-specific rate stats. |
fielding_is_qualified_pitcher | Float64 | Indicator flag for whether the pitcher qualifies for pitcher fielding rate statistics. |
fielding_successful_chances | Float64 | Total successful fielding chances defined as putouts plus assists (errors excluded). |
fielding_total_chances | Float64 | Total fielding chances (putouts + assists + errors) offered to the player during the season. |
fielding_full_innings_played | Float64 | Number of complete innings (three outs per side) the player appeared in the field. |
fielding_part_innings_played | Float64 | Number of fractional (partial) innings the player appeared in the field, expressed as a count of thirds. |
fielding_fielding_pct | Float64 | Fielding percentage calculated as successful chances divided by total chances (putouts + assists + errors). |
fielding_range_factor | Float64 | Range factor per nine innings (putouts + assists) / innings * 9, measuring a fielder's defensive range. |
fielding_zone_rating | Float64 | Percentage of batted balls in the fielder's defined zone that were successfully converted into outs. |
fielding_catcher_caught_stealing_pct | Float64 | Percentage of opposing stolen base attempts that resulted in the catcher throwing out the runner. |
fielding_catcher_era | Float64 | ERA of pitchers while this specific catcher was behind the plate over the season. |
fielding_def_warbr | Float64 | Defensive Wins Above Replacement (Baseball Reference methodology) attributable to the player's fielding. |
team_id | Int64 | Unique ESPN team identifier. |
team_uid | String | ESPN universal team identifier (UID). |
team_guid | String | ESPN team GUID. |
team_slug | String | URL-safe team identifier. |
team_location | String | Team city / location. |
team_name | String | Team name. |
team_abbreviation | String | Short team abbreviation (e.g. 'NYY'). |
team_display_name | String | Full team display name (e.g. 'New York Yankees'). |
team_short_display_name | String | Short team display name. |
team_color | String | Team primary color (hex, no leading '#'). |
team_alternate_color | String | Team alternate color (hex). |
team_is_active | Boolean | Team is active. |
team_logo_href | String |
Raises
| Exception | Description |
|---|---|
ValueError | season_type is not "regular"/"postseason". |
sportsdataverse.errors.NoDataError | ESPN returned 404. |
sportsdataverse.errors.AssetFetchError | The statistics, athlete or team fetch failed (403, 429, 5xx, a dead connection); only a 404 on the athlete or team node leaves those columns null. |
Example
from sportsdataverse.mlb import espn_mlb_player_stats
df = espn_mlb_player_stats(athlete_id=33192, season=2023)
df.select(["full_name", "team_display_name", "batting_home_runs"])
espn_mlb_schedule
espn_mlb_schedule(dates=None, season_type=None, limit=500, return_as_pandas=False, **kwargs) -> 'pl.DataFrame'
espn_mlb_schedule - look up the MLB schedule for a given date or season-year.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
dates | int | None | Date filter. Either a calendar date as YYYYMMDD or a season-year (e.g. 2024). When a 4-digit year is passed, the call returns the full season slate (paginated by limit). |
season_type | int | None | Season type — 1 = spring training, 2 = regular, 3 = postseason, 4 = all-star. |
limit | int | 500 | Number of records to return. Default 500. |
return_as_pandas | bool | False | If True, returns a pandas dataframe. If False (default), returns a polars dataframe. |
Returns
Polars dataframe containing the schedule. A day with no games returns a zero-row frame carrying the documented columns.
| col_name | type | description |
|---|---|---|
game_id | Int64 | Unique ESPN game/event identifier. |
date | String | Date in YYYY-MM-DD format. |
season_year | Int64 | |
season_type | Int64 | Season-type id. |
status_type_state | String | |
status_type_completed | Boolean | |
status_type_description | String | |
venue_id | Int64 | MLBAM venue ID. |
venue_full_name | String | |
venue_city | String | Venue city. |
venue_state | String | Venue state / province. |
home_id | Int64 | |
home_name | String | |
home_abbreviation | String | |
home_display_name | String | |
home_score | String | Home team score from the ESPN scoreboard: the final score for a completed game, the live score for one in progress (string). |
home_winner | Boolean | |
away_id | Int64 | |
away_name | String | |
away_abbreviation | String | |
away_display_name | String | |
away_score | String | Away team score from the ESPN scoreboard: the final score for a completed game, the live score for one in progress (string). |
away_winner | Boolean |
Example
from sportsdataverse.mlb import espn_mlb_schedule
sched = espn_mlb_schedule(dates=20240328)
print(sched.shape)
sched.select(["game_id", "home_name", "away_name", "status_type_description"]).head()
# Pull a regular-season slate from a season-year
reg = espn_mlb_schedule(dates=2024, season_type=2, limit=500)
reg.group_by("status_type_description").len().sort("len", descending=True)
# Pandas round-trip for one date
espn_mlb_schedule(dates=20240328, return_as_pandas=True).head()
espn_mlb_team_box
espn_mlb_team_box(game_id: 'int | str', return_as_pandas: 'bool' = False, **kwargs: 'Any') -> 'pl.DataFrame | pd.DataFrame'
Pull one MLB game's team box score from ESPN's summary endpoint.
The baseballr table of the same name (baseballr::espn_mlb_team_box): one row per team with
the game header, the team's identity, every batting, pitching and fielding stat ESPN reports for
the game, and the opponent's identity and score. One request.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
game_id | int | str | ESPN game (event) id, from espn_mlb_schedule or espn_mlb_scoreboard. | |
return_as_pandas | bool | False | Return a pandas frame instead of polars (pyarrow-backed columns, so the nullable ids stay integers). |
Returns
Two rows, one per team. game_id, season, season_type, game_date (US/Eastern date of the first pitch), game_date_time, the team_* identity columns, then one text column per stat named <group>_<stat> (batting_hits, pitching_strikeouts, fielding_errors, ...; ESPN sends about 180 for MLB and about 70 for college games), then home_away, team_score, team_winner and the opponent_* columns. Stat values are ESPN's display text, as baseballr keeps them. A zero-row frame with the documented columns when ESPN has no box score for the game. The stat columns vary by game, so stack games with pl.concat(frames, how="diagonal").
| col_name | type | description |
|---|---|---|
game_id | Int64 | ESPN game (event) id. |
season | Int32 | Season (four-digit year) of the game, from the summary header. |
season_type | Int32 | ESPN season type of the game: 1 preseason, 2 regular season, 3 postseason (MLB); ESPN files the college postseason under other types (the 2024 Men's College World Series final is 6). |
game_date | Date | US/Eastern calendar date of the scheduled first pitch. |
game_date_time | Datetime | Scheduled first pitch, US/Eastern. |
team_id | Int64 | ESPN team id of the team the row reports. |
team_uid | String | ESPN universal team id (UID), e.g. s:1 |
team_slug | String | URL slug of the team, e.g. st-louis-cardinals. |
team_location | String | Team city or school, e.g. St. Louis. |
team_name | String | Team nickname, e.g. Cardinals. |
team_abbreviation | String | Team abbreviation, e.g. STL. |
team_display_name | String | Full team name, e.g. St. Louis Cardinals. |
team_short_display_name | String | Short team name, e.g. Cardinals. |
team_color | String | Team primary color, hex without the leading #. |
team_alternate_color | String | Team alternate color, hex without the leading #. |
team_logo | String | URL of the team logo. |
batting_games_played | String | Team batting: Games Played (GP). ESPN's display text. |
batting_team_games_played | String | Team batting: Team Games Played (G). The number of games played by a team. ESPN's display text. |
batting_hit_by_pitch | String | Team batting: Hit By Pitch (HBP). The number of times a player has been by a pitch. ESPN's display text. |
batting_ground_balls | String | Team batting: Ground Balls (GO). The number of ground outs made by a player or team. ESPN's display text. |
batting_strikeouts | String | Team batting: Strikeouts (SO). The number of times a player strikes out. ESPN's display text. |
batting_rb_is | String | Team batting: Runs Batted In (RBI). The number of runs scored by a batter's play. ESPN's display text. |
batting_sac_hits | String | Team batting: Sacrifice Hit (SH). The number of sacrifice bunts that allow baserunners to advance. ESPN's display text. |
batting_hits | String | Team batting: Hits (H). The number of hits. ESPN's display text. |
batting_stolen_bases | String | Team batting: Stolen Bases (SB). The number of bases stolen. ESPN's display text. |
batting_walks | String | Team batting: Walks (BB). The number of times a batter reaches base on four balls. ESPN's display text. |
batting_catcher_interference | String | Team batting: Catcher Interference (CI). ESPN's display text. |
batting_runs | String | Team batting: Runs (R). The number of runs scored. ESPN's display text. |
batting_gid_ps | String | Team batting: Ground Into Double Play (GIDP). The number of times a batter grounds into a double play. ESPN's display text. |
batting_sac_flies | String | Team batting: Sacrifice Flies (SF). The number of fly outs on which a runner scored (a sacrifice fly). ESPN's display text. |
batting_at_bats | String | Team batting: At Bats (AB). The number of times a batter comes up to bat not counting walks and sacrifices. ESPN's display text. |
batting_home_runs | String | Team batting: Home Runs (HR). The number of hits that allowed the batter to round the bases and score without the aid of an error of the defense. ESPN's display text. |
batting_grand_slam_home_runs | String | Team batting: Grand Slam Home Runs (GSHR). The number of hits that allowed the batter and 3 of his teammates to round the bases and score without the aid of an error of the defense. ESPN's display text. |
batting_runners_left_on_base | String | Team batting: Runners Left On Base (LOB). The number runners remain on base after the batter makes an out at the plate. ESPN's display text. |
batting_triples | String | Team batting: Triples (3B). The number of hits that result in the batter reaching 3rd base without the aid of an error. ESPN's display text. |
batting_game_winning_rb_is | String | Team batting: Game Winning RBIs (GW RBI). The number of times a batter has a RBI that results in the batter's team winning the game. ESPN's display text. |
batting_intentional_walks | String | Team batting: Intentional Walks (IBB). The number of times that a batter is walked by four intentionally thrown balls by the pitcher. ESPN's display text. |
batting_doubles | String | Team batting: Doubles (2B). The number of times that a batter reaches second base as the result of a hit without an error being committed. ESPN's display text. |
batting_fly_balls | String | Team batting: Fly Balls (FO). The number of time a batter flies out. ESPN's display text. |
batting_caught_stealing | String | Team batting: Caught Stealing (CS). The number of times that a baserunner attempts to steal a base but is thrown out. ESPN's display text. |
batting_pitches | String | Team batting: Pitches (P). The number of pitches faced. ESPN's display text. |
batting_games_started | String | Team batting: Games Started (GS). The number of games that a batter starts. ESPN's display text. |
batting_pinch_at_bats | String | Team batting: Pinch At Bats (PAB). The number of times a batter has come in off the bench to pinch hit for another batter. ESPN's display text. |
batting_pinch_hits | String | Team batting: Pinch Hits (PH). The number of times a batter has in off the bench to pinch hit for another batter and gotten a hit. ESPN's display text. |
batting_player_rating | String | Team batting: Player Rating (RTG). ESPN's display text. |
batting_is_qualified | String | Team batting: Is Qualified (QUAL). Whether a batter is qualified in terms of at bats. ESPN's display text. |
batting_is_qualified_steals | String | Team batting: Is Qualified In Steals (QUAL STL). Whether a player is qualified in number of stolen base attempts. ESPN's display text. |
batting_total_bases | String | Team batting: Total Bases (TB). The number of bases calculated as 1 for a 1B, 2 for a 2B, 3 for a 3B and 4 for a HR. ESPN's display text. |
batting_plate_appearances | String | Team batting: Plate Appearances (PA). The number of times a batter comes up to bat. ESPN's display text. |
batting_projected_home_runs | String | Team batting: Projected Home Runs (PROJ HR). The number of home runs is expected to accumulate. ESPN's display text. |
batting_extra_base_hits | String | Team batting: Extra Base Hits (XBH). The number of hits that are greater than singles. ESPN's display text. |
batting_runs_created | String | Team batting: Runs Created (RC). The estimate of how many runs a player has created. ESPN's display text. |
batting_avg | String | Team batting: Batting Average (AVG). The average number of times the batter reached successfully on base due to a hit: hits / atBats. ESPN's display text. |
batting_pinch_avg | String | Team batting: Pinch Hit Average (PH%). The batting when a batter pinch hits. ESPN's display text. |
batting_slug_avg | String | Team batting: Slugging Percentage (SLG). Slugging percentage is a metric that is meant to measuring how many bases the hitter safely advances to after making contact with the ball: (totalBases / atBats). ESPN's display text. |
batting_secondary_avg | String | Team batting: Secondary Average (SECA). The average of extra bases gained via hits, walks and stolen bases versus at bats. ESPN's display text. |
batting_on_base_pct | String | Team batting: On Base Percentage (OBP): (hits + walks + hit by pitch) / (at bats + walks + hit by pitch + sacrifice flies). ESPN's display text. |
batting_ops | String | Team batting: OBP Pct + SLG Pct (OPS). The average calculated by adding up on-base percentage and slugging percentage. ESPN's display text. |
batting_ground_to_fly_ratio | String | Team batting: Ground To Fly Ball Ratio (GO/FO). The ratio of ground outs to fly outs. ESPN's display text. |
batting_runs_created_per27outs | String | Team batting: Runs Created Per 27 Outs (RC/27). The estimated number of runs created per 27 outs played. ESPN's display text. |
batting_batter_rating | String | Team batting: Batter Rating (RTG). ESPN's display text. |
batting_at_bats_per_home_run | String | Team batting: At Bats Per Home Run (AB/HR). The ratio of at bats per home run hit. ESPN's display text. |
batting_stolen_base_pct | String | Team batting: Stolen Base Percentage (SB%). The percentage of stolen bases successfully stolen by a baserunner. ESPN's display text. |
batting_pitches_per_plate_appearance | String | Team batting: Pitches Per Plate Appearance (P/PA). The average number of pitches a batter sees per plate appearance. ESPN's display text. |
batting_isolated_power | String | Team batting: Isolated Power (ISOP). The measure of a batter's ability to hit for extra bases, calculated by subtracting batting average from slugging percentage. ESPN's display text. |
batting_walk_to_strikeout_ratio | String | Team batting: Walk To Strikeout Ratio (BB/K). The number of walks to the number of strikeouts by a batter. ESPN's display text. |
batting_walks_per_plate_appearance | String | Team batting: Walks Per Plate Appearance (BB/PA). The ratio of walks to plate appearances for a batter. ESPN's display text. |
batting_secondary_avg_minus_ba | String | Team batting: Secondary Average Minus Batting Average (SECMBA). The metric calculated by subtracting batitng average from secondary average. ESPN's display text. |
batting_runs_produced | String | Team batting: Runs Produced (RP). The estimation of how many runs a batter has contributed. ESPN's display text. |
batting_runs_ratio | String | Team batting: Runs Ratio (RR). The ratio of runs scored to plate appearances by a batter. ESPN's display text. |
batting_patience_ratio | String | Team batting: Patience Ratio (PR). The metric that attempts to measure a batter's patience. ESPN's display text. |
batting_bipa | String | Team batting: Balls In Play Average (BIPA). The average of a batter when the ball is put in play or batting average without factoring at bats that result in a home run or a strikeout. ESPN's display text. |
batting_mlb_rating | String | Team batting: MLB Rating (MLB). The MLB rating. ESPN's display text. |
batting_off_warbr | String | Team batting: Offensive Wins Above Replacement (OWAR). ESPN's display text. |
batting_warbr | String | Team batting: Wins Above Replacement (WAR). ESPN's display text. |
pitching_games_played | String | Team pitching: Games Played (GP). ESPN's display text. |
pitching_team_games_played | String | Team pitching: Team Games Played (G). The number of games played by a team. ESPN's display text. |
pitching_saves | String | Team pitching: Saves (SV). The number of times a pitcher enters and finishes the game without surrendering the lead in a save opportunity. ESPN's display text. |
pitching_ground_balls | String | Team pitching: Ground Balls (GB). The number of ground balls hit against a pitcher. ESPN's display text. |
pitching_strikeouts | String | Team pitching: Strikeouts (K). The number of times the pitcher struck out a batter. ESPN's display text. |
pitching_sac_flies | String | Team pitching: Sacrifice Flies (SF). The number of sacrifice flies surrendered. ESPN's display text. |
pitching_losses | String | Team pitching: Losses (L). The number of losses for a pitcher. ESPN's display text. |
pitching_hits | String | Team pitching: Hits (H). The number of hits surrendered by a pitcher. ESPN's display text. |
pitching_earned_runs | String | Team pitching: Earned runs (ER). The number of earned runs surrendered by a pitcher. ESPN's display text. |
pitching_batters_hit | String | Team pitching: Batters Hit (BH). The number of batters hit by a pitcher. ESPN's display text. |
pitching_walks | String | Team pitching: Walks (BB). The number of times a pitcher surrenders a base on balls. ESPN's display text. |
pitching_runs | String | Team pitching: Runs (R). The number of runs allowed by a pitcher. ESPN's display text. |
pitching_stolen_bases | String | Team pitching: Stolen Bases (SB). The number of times a pitcher allows a baserunner to steal a base. ESPN's display text. |
pitching_caught_stealing | String | Team pitching: Caught Stealing (CS). The number of times a pitcher gets out a baserunner trying to steal a base. ESPN's display text. |
pitching_sac_bunts | String | Team pitching: Sacrifice Bunts (SH). The number of times a sacrifce bunt is allowed by a pitcher. ESPN's display text. |
pitching_save_opportunities | String | Team pitching: Save Opportunities (SVOP). The number of times a pitcher enters the game with a lead of fewer than 4 runs and pitches at least one inning; enters the game with the potentional tying run on base, at bat, or on deck; or pitches three or more innings with a lead. ESPN's display text. |
pitching_home_runs | String | Team pitching: Home Runs (HR). The number of times a pitcher has allowed a home run. ESPN's display text. |
pitching_triples | String | Team pitching: Triples (3B). The number of triples surrendered by the picher. ESPN's display text. |
pitching_finishes | String | Team pitching: Finishes (FIN). The number of times that a pitcher finishes the game. ESPN's display text. |
pitching_balks | String | Team pitching: Balks (BK). The number of times that a pitcher balks. ESPN's display text. |
pitching_intentional_walks | String | Team pitching: Intentional Walks (IBB). The number of times that a pitcher has intentionally walked a batter. ESPN's display text. |
pitching_fly_balls | String | Team pitching: Fly Balls (FB). The number of fly balls a pitcher has produced. ESPN's display text. |
pitching_batters_faced | String | Team pitching: Batters Faced (TBF). The number of batters faced by a pitcher. ESPN's display text. |
pitching_holds | String | Team pitching: Holds (HLD). The number of times a pitcher enters the game with the lead, gets at least an out and leaves the game wihtout having given up the lead. ESPN's display text. |
pitching_doubles | String | Team pitching: Doubles (2B). The number of doubles allowed by a pitcher. ESPN's display text. |
pitching_wins | String | Team pitching: Wins (W). The number of times the pitcher was attributed with a win. ESPN's display text. |
pitching_complete_games | String | Team pitching: Complete Games (CG). The number of times that pitcher starts and finishes a game. ESPN's display text. |
pitching_perfect_games | String | Team pitching: Perfect Games (PG). The number of times the pitcher pitches a complete games shutout victory that lasts a minimum of nine innings in which no opposing player reaches base for any reason. ESPN's display text. |
pitching_wild_pitches | String | Team pitching: Wild Pitches (WP). The number of times that a pitcher pitches a wild pitch. ESPN's display text. |
pitching_rb_is | String | Team pitching: Runs Batted In (RBI). The number of runs scored due to the actions of the batter. ESPN's display text. |
pitching_third_innings | String | Team pitching: Third Innings Pitched (TIP). The number of third innings pitched. ESPN's display text. |
pitching_team_earned_runs | String | Team pitching: Earned Runs (ER). The number of earned runs allowed. ESPN's display text. |
pitching_shutouts | String | Team pitching: Shutouts (SHO). The number of times that a pitcher allows zero runs. ESPN's display text. |
pitching_pickoff_attempts | String | Team pitching: Pickoff Attempts (POA). The number of times that a pitcher throws over to try and pickoff a baserunner. ESPN's display text. |
pitching_pitches | String | Team pitching: Pitches (P). The number of pitches a pitcher throws. ESPN's display text. |
pitching_run_support | String | Team pitching: Run Support (RSUP). The average number of runs scored while the pitcher is pitching. ESPN's display text. |
pitching_catcher_interference | String | Team pitching: Catcher Interference (CI). The number of times there is catcher interference. ESPN's display text. |
pitching_pitches_as_starter | String | Team pitching: Pitches As Starter (PAS). The number of pitches thrown by a pitcher when they start a game. ESPN's display text. |
pitching_games_started | String | Team pitching: Games Started (GS). The number of games started by a pitcher. ESPN's display text. |
pitching_avg_game_score | String | Team pitching: Game Score (GSC). The average game score for a pitcher. ESPN's display text. |
pitching_quality_starts | String | Team pitching: Quality Starts (QS). The number of quality starts for a pitcher. ESPN's display text. |
pitching_inherited_runners | String | Team pitching: Inherited Runners (IR). The number of baserunners when a relief pitcher enters the game. ESPN's display text. |
pitching_inherited_runners_scored | String | Team pitching: Inherited Runners Scored (IRS). The number of inherited runners who scored. ESPN's display text. |
pitching_player_rating | String | Team pitching: Player Rating (RTG). The rating of a pitcher. ESPN's display text. |
pitching_at_bats | String | Team pitching: At Bats (AB). The number of at bats. ESPN's display text. |
pitching_opponent_total_bases | String | Team pitching: Total Bases (TB). The number of bases allowed by the pitcher. ESPN's display text. |
pitching_is_qualified | String | Team pitching: Is Qualified (QUAL). Whether a player is qualified as a pitcher. ESPN's display text. |
pitching_is_qualified_saves | String | Team pitching: Is Qualified (QUAL). Whether a player is qualified for saves. ESPN's display text. |
pitching_full_innings | String | Team pitching: Full Innings (FI). The number of full innings pitched by a pitcher. ESPN's display text. |
pitching_part_innings | String | Team pitching: Partial Innings (PI). The number of times a pitcher pitches a part of an inning. ESPN's display text. |
pitching_blown_saves | String | Team pitching: Blown Saves (BLSV). The number of times a pitchers has a save opportunity and surrenders the lead. ESPN's display text. |
pitching_innings | String | Team pitching: Innings pitched (IP). The number of innings pitched. ESPN's display text. |
pitching_era | String | Team pitching: Earned Run Average (ERA). The average number of runs a pitcher yields per 9 innings thrown. ESPN's display text. |
pitching_whip | String | Team pitching: Walks Plus Hits Per Inning Pitched (WHIP). The number representing walks plus hits divided by innings pitched. ESPN's display text. |
pitching_win_pct | String | Team pitching: Win Percentage (W%). The percentage of wins for a pitcher. ESPN's display text. |
pitching_caught_stealing_pct | String | Team pitching: Caught Stealing Percentage (CS%). The percentage of baserunners caught stealing. ESPN's display text. |
pitching_ground_to_fly_ratio | String | Team pitching: Ground To Fly Ball Ratio (G/F). The number of ground balls to fly balls. ESPN's display text. |
pitching_pitches_per_start | String | Team pitching: Pitches Per Start (P/S). The average number of pitches per game started by a pitcher. ESPN's display text. |
pitching_pitches_per_inning | String | Team pitching: Pitches Per Inning (P/I). The average number of pitches per inning. ESPN's display text. |
pitching_pitches_per_plate_appearance | String | Team pitching: Pitches Per Plate Appearance (P/PA). The average number of pitches per plate appearance for a pitcher. ESPN's display text. |
pitching_run_support_avg | String | Team pitching: Run Support Average (RSA). The average run support a pitcher receives per game. ESPN's display text. |
pitching_opponent_avg | String | Team pitching: Opponent Batting Average (OBA). The opponent's batting average for a pitcher. ESPN's display text. |
pitching_opponent_slug_avg | String | Team pitching: Opponent's Slugging pct. (OSLUG). The opponent's slugging percentage for a pitcher. ESPN's display text. |
pitching_opponent_on_base_pct | String | Team pitching: Opponent's On-base pct. (OOBP). THe opponent's on base percentage for a pitcher. ESPN's display text. |
pitching_opponent_ops | String | Team pitching: Opponent's OPB Pct + SLG Pct (OOPS). The opponent's on base percentage plus slugging percentage for a pitcher. ESPN's display text. |
pitching_save_pct | String | Team pitching: Save Percentage (SV%). The percentage of save opportunities that are saved. ESPN's display text. |
pitching_strikeouts_per_nine_innings | String | Team pitching: Strikeouts Per 9 Innings (K/9). The average number of strikeouts for a pitcher per 9 innings. ESPN's display text. |
pitching_strikeout_to_walk_ratio | String | Team pitching: Strikeout To Walk Ratio (K/BB). The ratio of strikeouts to walks by a pitcher. ESPN's display text. |
pitching_tough_losses | String | Team pitching: Tough Losses (TL). The number of losses in games that are quality starts by the pitcher. ESPN's display text. |
pitching_cheap_wins | String | Team pitching: Cheap Wins (CW). The number of wins that are not quality starts by the pitcher. ESPN's display text. |
pitching_save_opportunities_per_win | String | Team pitching: Save Opportunities Per Win (SVOP/W). The number of save opportunities per win. ESPN's display text. |
pitching_bipa | String | Team pitching: Balls In Play Average (BIPA). The batter's batting average when facing the pitcher without taking into account home runs or strikeouts. ESPN's display text. |
pitching_total_bases | String | Team pitching: Total Bases (TB). The number of bases allowed by a pitcher. ESPN's display text. |
pitching_pitch_count | String | Team pitching: Pitch Count (PC). The number of pitches thrown. ESPN's display text. |
pitching_strikes | String | Team pitching: Strikes (S). The number of strikes thrown. ESPN's display text. |
pitching_strike_pitch_ratio | String | Team pitching: Strike To Pitch Ratio (S/P). The ratio of strikes thrown to pitches thrown. ESPN's display text. |
pitching_warbr | String | Team pitching: Wins Above Replacement (WAR). ESPN's display text. |
fielding_games_played | String | Team fielding: Games Played (GP). ESPN's display text. |
fielding_team_games_played | String | Team fielding: Team Games Played (G). The number of games played by a team. ESPN's display text. |
fielding_double_plays | String | Team fielding: Double Plays (DP). The number of double plays a fielder has been a part of as either the assister or putouter. ESPN's display text. |
fielding_opportunities | String | Team fielding: Opportunities (OPP). The number of opportunites. ESPN's display text. |
fielding_errors | String | Team fielding: Errors (E). The number of times a fielder fails to make the play they are expected to make. ESPN's display text. |
fielding_passed_balls | String | Team fielding: Passed Balls (PB). The number of times the ball is dropped or passes by the catcher. ESPN's display text. |
fielding_assists | String | Team fielding: Assists (A). The number of times a fielder is involved in an out when the fielder is not the putouter. ESPN's display text. |
fielding_outfield_assists | String | Team fielding: Outfield Assists (OA). The number of times an outfielder fielder is involved in an out when the fielder is not the putouter. ESPN's display text. |
fielding_pickoffs | String | Team fielding: Pickoffs (PO). The number of times that a pitcher or catcher throws over and picks off a baserunner. ESPN's display text. |
fielding_putouts | String | Team fielding: Putouts (PO). The number of times the fielder tags or forces the out of a baserunner. ESPN's display text. |
fielding_outs_on_field | String | Team fielding: Outs On Field (OOF). The number of outs on field. ESPN's display text. |
fielding_triple_plays | String | Team fielding: TP. The number of times that a fielder is involved in a triple play. ESPN's display text. |
fielding_balls_in_zone | String | Team fielding: Balls In Zone (BIZ). The number of balls that were batted into a fielder's zone. ESPN's display text. |
fielding_extra_bases | String | Team fielding: Extra Bases (XB). The number of extra base hits allowed. ESPN's display text. |
fielding_outs_made | String | Team fielding: Outs Made (OM). The number of outs made by a fielder. ESPN's display text. |
fielding_hits | String | Team fielding: Hits (H). The number of hits surrendered. ESPN's display text. |
fielding_total_bases | String | Team fielding: Total Bases (TB). The number of bases allowed. ESPN's display text. |
fielding_games_started | String | Team fielding: Games Started (GS). The number of games started by a fielder. ESPN's display text. |
fielding_catcher_third_innings_played | String | Team fielding: Third Innings Played (TIP). The number of third innings played by a catcher. ESPN's display text. |
fielding_catcher_caught_stealing | String | Team fielding: Caught Stealing (CS). The number of times a catcher throws a baserunner trying to steal a base. ESPN's display text. |
fielding_catcher_stolen_bases_allowed | String | Team fielding: Stolen Bases Allowed (SBA). The number of stolen bases that a catcher allows. ESPN's display text. |
fielding_catcher_earned_runs | String | Team fielding: Earned Runs (ER). The number of runs allowed by the catcher that aren't the result of an error or passed ball. ESPN's display text. |
fielding_is_qualified | String | Team fielding: Qualified (QUAL). Whether a player is qualified as a fielder. ESPN's display text. |
fielding_is_qualified_catcher | String | Team fielding: Qualified Catcher (QUAL). Whether a player qualifies a catcher. ESPN's display text. |
fielding_is_qualified_pitcher | String | Team fielding: Qualified Pitcher (QUAL). Whether a player qualifies as a pitcher. ESPN's display text. |
fielding_successful_chances | String | Team fielding: Successful Chances (SC). The number of outs involved in calculated by assists plus putouts. ESPN's display text. |
fielding_total_chances | String | Team fielding: Total Chances (TC). The number of chances a fielder has to make an out calculated by assists plus putouts plus errors. ESPN's display text. |
fielding_full_innings_played | String | Team fielding: Full Innings (FIP). The number of fully completed innings by a fielder. ESPN's display text. |
fielding_part_innings_played | String | Team fielding: Part Innings Played (PIP). The number of at least partial innings played by a fielder. ESPN's display text. |
fielding_fielding_pct | String | Team fielding: Fielding Percentage (FP). The percentage of plays made by a fielder given the total number of chances. ESPN's display text. |
fielding_range_factor | String | Team fielding: Range Factor (RF). The estimation of how much field a fielder can cover. ESPN's display text. |
fielding_zone_rating | String | Team fielding: Zone Rating (ZR). The metric used to estimate the ability of a fielder to defend a zone on the field. ESPN's display text. |
fielding_catcher_caught_stealing_pct | String | Team fielding: Caught Stealing Percentage (CS%). The percentage of baserunners caught by the catcher given the total number of steal attempts. ESPN's display text. |
fielding_catcher_era | String | Team fielding: Earned Run Average (ERA). The number of earned runs multipled by 9 divided by the number of innings caught. ESPN's display text. |
fielding_def_warbr | String | Team fielding: Defensive Wins Above Replacement (DWAR). ESPN's display text. |
home_away | String | Whether the team was the home or the away side (home / away). |
team_score | Int32 | Runs the team scored in the game. |
team_winner | Boolean | True when the team won the game. |
opponent_team_id | Int64 | ESPN team id of the opponent. |
opponent_team_location | String | Opponent city or school. |
opponent_team_name | String | Opponent nickname. |
opponent_team_abbreviation | String | Opponent abbreviation. |
opponent_team_display_name | String | Full name of the opponent, e.g. Chicago Cubs. |
opponent_team_logo | String | URL of the opponent's logo. |
opponent_team_color | String | Opponent primary color, hex without the leading #. |
opponent_team_alternate_color | String | Opponent alternate color, hex without the leading #. |
opponent_team_score | Int32 | Runs the opponent scored in the game. |
Raises
| Exception | Description |
|---|---|
NoDataError | ESPN answered 404 for the game. |
AssetFetchError | The request failed (a non-2xx answer or a connection failure after retries). |
Example
from sportsdataverse.mlb import espn_mlb_team_box
team_box = espn_mlb_team_box(game_id=401569534)
print(team_box.shape)
# Pipeline next step (one line)
team_box.select("team_abbreviation", "batting_hits", "batting_home_runs", "team_score")
espn_mlb_teams
espn_mlb_teams(return_as_pandas=False, **kwargs) -> 'pl.DataFrame'
espn_mlb_teams - look up MLB teams from ESPN's Site v2 API.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
return_as_pandas | bool | False | If True, returns a pandas dataframe. If False (default), returns a polars dataframe. |
Returns
Polars dataframe of the MLB teams, one row per team, with the columns in the returns table. A payload without teams returns a zero-row frame with those columns. The result is not cached: every call fetches (through the package's opt-in TTL response cache, sportsdataverse.cache, when it is on).
| col_name | type | description |
|---|---|---|
team_abbreviation | String | Short team abbreviation (e.g. 'NYY'). |
team_alternate_color | String | Team alternate color (hex). |
team_color | String | Team primary color (hex, no leading '#'). |
team_display_name | String | Full team display name (e.g. 'New York Yankees'). |
team_id | Int64 | Unique ESPN team identifier. |
team_is_active | Boolean | Team is active. |
team_is_all_star | Boolean | Team is all star. |
team_location | String | Team city / location. |
team_logos | List | |
team_name | String | Team name. |
team_nickname | String | |
team_short_display_name | String | Short team display name. |
team_slug | String | URL-safe team identifier. |
team_uid | String | ESPN universal team identifier (UID). |
Raises
| Exception | Description |
|---|---|
NoDataError | ESPN answered 404 for the teams resource. |
AssetFetchError | The fetch failed (403, 429, 5xx, a dropped connection); never returned as an empty frame. |
Example
from sportsdataverse.mlb import espn_mlb_teams
teams = espn_mlb_teams()
print(teams.shape)
teams.select(["team_id", "team_abbreviation", "team_display_name"]).head()
# Find Los Angeles Dodgers (team_id 19)
import polars as pl
teams.filter(pl.col("team_id") == 19).to_dicts()
# Pandas round-trip
teams_pd = espn_mlb_teams(return_as_pandas=True)
teams_pd[["team_id", "team_abbreviation", "team_display_name"]].head()