The dataset viewer is not available for this split.
Error code: StreamingRowsError
Exception: CastError
Message: Couldn't cast
id: string
title: string
code_file: string
language: string
kernel_type: string
is_private: bool
enable_gpu: bool
enable_tpu: bool
enable_internet: bool
dataset_sources: list<item: string>
child 0, item: string
licenses: list<item: struct<name: string>>
child 0, item: struct<name: string>
child 0, name: string
keywords: list<item: string>
child 0, item: string
description: string
subtitle: string
isPrivate: bool
resources: list<item: struct<path: string, description: string, schema: struct<fields: list<item: struct<name: (... 46 chars omitted)
child 0, item: struct<path: string, description: string, schema: struct<fields: list<item: struct<name: string, typ (... 34 chars omitted)
child 0, path: string
child 1, description: string
child 2, schema: struct<fields: list<item: struct<name: string, type: string, description: string>>>
child 0, fields: list<item: struct<name: string, type: string, description: string>>
child 0, item: struct<name: string, type: string, description: string>
child 0, name: string
child 1, type: string
child 2, description: string
to
{'title': Value('string'), 'id': Value('string'), 'subtitle': Value('string'), 'description': Value('string'), 'isPrivate': Value('bool'), 'licenses': List({'name': Value('string')}), 'keywords': List(Value('string')), 'resources': List({'path': Value('string'), 'description': Value('string'), 'schema': {'fields': List({'name': Value('string'), 'type': Value('string'), 'description': Value('string')})}})}
because column names don't match
Traceback: Traceback (most recent call last):
File "/src/services/worker/src/worker/utils.py", line 149, in get_rows_or_raise
return get_rows(
dataset=dataset,
...<4 lines>...
column_names=column_names,
)
File "/src/libs/libcommon/src/libcommon/utils.py", line 274, in decorator
return func(*args, **kwargs)
File "/src/services/worker/src/worker/utils.py", line 129, in get_rows
rows_plus_one = list(itertools.islice(safe_iter(ds, dataset=dataset), rows_max_number + 1))
File "/src/services/worker/src/worker/utils.py", line 544, in safe_iter
yield from ds.decode(False) if ds.features else ds
File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 3074, in __iter__
for key, example in ex_iterable:
^^^^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2578, in __iter__
for key, pa_table in self._iter_arrow():
~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2603, in _iter_arrow
for key, pa_table in self.ex_iterable._iter_arrow():
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 577, in _iter_arrow
for key, pa_table in iterator:
^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 459, in _iter_arrow
for key, pa_table in self.generate_tables_fn(**gen_kwags):
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/json/json.py", line 373, in _generate_tables
self._cast_table(pa_table, json_field_paths=json_field_paths),
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/json/json.py", line 132, in _cast_table
pa_table = table_cast(pa_table, self.info.features.arrow_schema)
File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2394, in table_cast
return cast_table_to_schema(table, schema)
File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2322, in cast_table_to_schema
raise CastError(
...<3 lines>...
)
datasets.table.CastError: Couldn't cast
id: string
title: string
code_file: string
language: string
kernel_type: string
is_private: bool
enable_gpu: bool
enable_tpu: bool
enable_internet: bool
dataset_sources: list<item: string>
child 0, item: string
licenses: list<item: struct<name: string>>
child 0, item: struct<name: string>
child 0, name: string
keywords: list<item: string>
child 0, item: string
description: string
subtitle: string
isPrivate: bool
resources: list<item: struct<path: string, description: string, schema: struct<fields: list<item: struct<name: (... 46 chars omitted)
child 0, item: struct<path: string, description: string, schema: struct<fields: list<item: struct<name: string, typ (... 34 chars omitted)
child 0, path: string
child 1, description: string
child 2, schema: struct<fields: list<item: struct<name: string, type: string, description: string>>>
child 0, fields: list<item: struct<name: string, type: string, description: string>>
child 0, item: struct<name: string, type: string, description: string>
child 0, name: string
child 1, type: string
child 2, description: string
to
{'title': Value('string'), 'id': Value('string'), 'subtitle': Value('string'), 'description': Value('string'), 'isPrivate': Value('bool'), 'licenses': List({'name': Value('string')}), 'keywords': List(Value('string')), 'resources': List({'path': Value('string'), 'description': Value('string'), 'schema': {'fields': List({'name': Value('string'), 'type': Value('string'), 'description': Value('string')})}})}
because column names don't matchNeed help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
YAML Metadata Warning:The task_categories "tabular" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, audio-text-to-text, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-ranking, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, image-text-to-image, image-text-to-video, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, video-text-to-text, keypoint-detection, visual-document-retrieval, any-to-any, video-to-video, other
MLB Player Seasons 2015-2025
Subtitle: 20,318 player-season rows with batting, pitching and fielding stats
Tags: tabular, sports, baseball
Dataset File: mlb_player_seasons.csv (20,318 rows, 88 columns, 5.8 MB)
Provenance & Source: MLB StatsAPI (statsapi.mlb.com)
Expected Update Frequency: annually
π Description
MLB player seasons, 2015β2025
The MLB StatsAPI exposes season totals for every player. This dataset contains 20,318 player-season rows across 11 seasons, with 88 parameters β every statistic returned by the API plus identity and derived rate fields.
- Identity β player id/name, team and league ids/names, season, position and group.
- Hitting stats β games, plate appearances, at-bats, runs, hits, doubles, triples, home runs, RBI, walks, strikeouts, stolen bases, average, OBP, slugging, OPS, BABIP and more (blank for pitchers).
- Pitching stats β wins, losses, ERA, innings, strikeouts, saves, WHIP, home runs allowed, hit batters and more (blank for batters).
- Derived β pitcher/batter flags, extra-base hits, strikeout/walk/HR rates, isolated power, decimal innings, OPS and ERA bands, and qualification flags.
11,350 batting rows and 8,968 pitching rows make this a complete two-way player-season table for sabermetrics and fantasy analysis.
π§Ύ Columns (88)
player_id, player_name, team_id, team_name, league_id, league_name, season, group, position, is_pitcher, is_batter, age, air_outs, at_bats, at_bats_per_home_run, avg, babip, balks, base_on_balls, batters_faced, blown_saves, catchers_interference, caught_stealing, caught_stealing_percentage, complete_games, doubles, earned_runs, era, games_finished, games_pitched, games_played, games_started, ground_into_double_play, ground_outs, ground_outs_to_airouts, hit_batsmen, hit_by_pitch, hits, hits_per9_inn, holds, home_runs, home_runs_per9, inherited_runners, inherited_runners_scored, innings_pitched, intentional_walks, left_on_base, losses, number_of_pitches, obp, ops, outs, pickoffs, pitches_per_inning, plate_appearances, rbi, runs, runs_scored_per9, sac_bunts, sac_flies, save_opportunities, saves, shutouts, slg, stolen_base_percentage, stolen_bases, strike_outs, strike_percentage, strikeout_walk_ratio, strikeouts_per9_inn, strikes, total_bases, triples, walks_per9_inn, whip, wild_pitches, win_percentage, wins, extra_base_hits, strikeout_rate, walk_rate, home_run_rate, slg_minus_avg, innings_pitched_decimal, ops_band, era_band, is_qualified_batter, is_qualified_pitcher
π‘ Ideas for using this data
- Two-way players β find players with meaningful batting and pitching rows.
- Aging curves β performance by age, separately for batters and pitchers.
- Power vs contact β home-run rate vs strikeout rate.
- Team production β aggregate team offence and pitching by season.
- Breakout seasons β largest year-over-year improvements.
- Qualification effects β how rate stats change when minimums are applied.
- Position scarcity β offensive output by position.
- ERA vs WHIP β pitcher profiles and outliers.
- Forecasting β predict next-season OPS or ERA from prior seasons.
π Files
| File | What it is |
|---|---|
mlb_player_seasons.csv |
20,318 player-seasons x 88 parameters. |
data_dictionary.csv |
Column / type / description for every field. |
notebook.ipynb |
Starter notebook that loads the CSV and analyses it. |
dataset-metadata.json |
Kaggle API metadata. |
about.md |
Plain-text About block. |
π·οΈ Tags
baseball, mlb, sports, statistics, players, sabermetrics, seasons
π Provenance
- Source: MLB StatsAPI,
https://statsapi.mlb.com/api/v1/stats?stats=season&group={group}&season={year}&sportId=1. - Scope: all players with a season total in 2015β2025, for both hitting and pitching.
- Processing: every stat key retained and snake-cased; player/team/league/position identity joined; rate, band and qualification fields derived.
- Snapshot date: 22 November 2026.
π Update frequency
Daily during the season. StatsAPI updates statistics after each game.
β οΈ Caveats
- Stats are regular-season totals only; postseason is a separate endpoint.
- Players traded mid-season appear once per team in some responses, so rows are team-specific.
- Rate stats are not park- or league-adjusted.
- Innings pitched uses baseball notation (outs) and is converted to decimal for analysis.
- Very small sample sizes (few plate appearances) produce extreme rate stats.
- The API can revise statistics after the season.
- Column names follow the API's stat keys, snake-cased.
π Licence
MLB data is provided by MLB Advanced Media for public informational use.
π Column Definitions & File Header
| # | Column Name | Data Type | Description |
|---|---|---|---|
| 1 | player_id |
number |
MLB person identifier. |
| 2 | player_name |
string |
Player full name. |
| 3 | team_id |
number |
Team identifier. |
| 4 | team_name |
string |
Team name. |
| 5 | league_id |
number |
League identifier. |
| 6 | league_name |
string |
League name. |
| 7 | season |
number |
Season year. |
| 8 | group |
string |
hitting or pitching. |
| 9 | position |
string |
Position abbreviation. |
| 10 | is_pitcher |
boolean |
true for pitching rows. |
| 11 | is_batter |
boolean |
true for hitting rows. |
| 12 | age |
number |
MLB StatsAPI field or derived metric. |
| 13 | air_outs |
number |
MLB StatsAPI field or derived metric. |
| 14 | at_bats |
number |
MLB StatsAPI field or derived metric. |
| 15 | at_bats_per_home_run |
string |
MLB StatsAPI field or derived metric. |
| 16 | avg |
number |
MLB StatsAPI field or derived metric. |
| 17 | babip |
string |
MLB StatsAPI field or derived metric. |
| 18 | balks |
number |
MLB StatsAPI field or derived metric. |
| 19 | base_on_balls |
number |
MLB StatsAPI field or derived metric. |
| 20 | batters_faced |
number |
MLB StatsAPI field or derived metric. |
| 21 | blown_saves |
number |
MLB StatsAPI field or derived metric. |
| 22 | catchers_interference |
number |
MLB StatsAPI field or derived metric. |
| 23 | caught_stealing |
number |
MLB StatsAPI field or derived metric. |
| 24 | caught_stealing_percentage |
string |
MLB StatsAPI field or derived metric. |
| 25 | complete_games |
number |
MLB StatsAPI field or derived metric. |
| 26 | doubles |
number |
MLB StatsAPI field or derived metric. |
| 27 | earned_runs |
number |
MLB StatsAPI field or derived metric. |
| 28 | era |
number |
MLB StatsAPI field or derived metric. |
| 29 | games_finished |
number |
MLB StatsAPI field or derived metric. |
| 30 | games_pitched |
number |
MLB StatsAPI field or derived metric. |
| 31 | games_played |
number |
MLB StatsAPI field or derived metric. |
| 32 | games_started |
number |
MLB StatsAPI field or derived metric. |
| 33 | ground_into_double_play |
number |
MLB StatsAPI field or derived metric. |
| 34 | ground_outs |
number |
MLB StatsAPI field or derived metric. |
| 35 | ground_outs_to_airouts |
string |
MLB StatsAPI field or derived metric. |
| 36 | hit_batsmen |
number |
MLB StatsAPI field or derived metric. |
| 37 | hit_by_pitch |
number |
MLB StatsAPI field or derived metric. |
| 38 | hits |
number |
MLB StatsAPI field or derived metric. |
| 39 | hits_per9_inn |
number |
MLB StatsAPI field or derived metric. |
| 40 | holds |
number |
MLB StatsAPI field or derived metric. |
| 41 | home_runs |
number |
MLB StatsAPI field or derived metric. |
| 42 | home_runs_per9 |
number |
MLB StatsAPI field or derived metric. |
| 43 | inherited_runners |
number |
MLB StatsAPI field or derived metric. |
| 44 | inherited_runners_scored |
number |
MLB StatsAPI field or derived metric. |
| 45 | innings_pitched |
number |
MLB StatsAPI field or derived metric. |
| 46 | intentional_walks |
number |
MLB StatsAPI field or derived metric. |
| 47 | left_on_base |
number |
MLB StatsAPI field or derived metric. |
| 48 | losses |
number |
MLB StatsAPI field or derived metric. |
| 49 | number_of_pitches |
number |
MLB StatsAPI field or derived metric. |
| 50 | obp |
number |
MLB StatsAPI field or derived metric. |
| 51 | ops |
number |
MLB StatsAPI field or derived metric. |
| 52 | outs |
number |
MLB StatsAPI field or derived metric. |
| 53 | pickoffs |
number |
MLB StatsAPI field or derived metric. |
| 54 | pitches_per_inning |
number |
MLB StatsAPI field or derived metric. |
| 55 | plate_appearances |
number |
MLB StatsAPI field or derived metric. |
| 56 | rbi |
number |
MLB StatsAPI field or derived metric. |
| 57 | runs |
number |
MLB StatsAPI field or derived metric. |
| 58 | runs_scored_per9 |
number |
MLB StatsAPI field or derived metric. |
| 59 | sac_bunts |
number |
MLB StatsAPI field or derived metric. |
| 60 | sac_flies |
number |
MLB StatsAPI field or derived metric. |
| 61 | save_opportunities |
number |
MLB StatsAPI field or derived metric. |
| 62 | saves |
number |
MLB StatsAPI field or derived metric. |
| 63 | shutouts |
number |
MLB StatsAPI field or derived metric. |
| 64 | slg |
number |
MLB StatsAPI field or derived metric. |
| 65 | stolen_base_percentage |
string |
MLB StatsAPI field or derived metric. |
| 66 | stolen_bases |
number |
MLB StatsAPI field or derived metric. |
| 67 | strike_outs |
number |
MLB StatsAPI field or derived metric. |
| 68 | strike_percentage |
number |
MLB StatsAPI field or derived metric. |
| 69 | strikeout_walk_ratio |
string |
MLB StatsAPI field or derived metric. |
| 70 | strikeouts_per9_inn |
number |
MLB StatsAPI field or derived metric. |
| 71 | strikes |
number |
MLB StatsAPI field or derived metric. |
| 72 | total_bases |
number |
MLB StatsAPI field or derived metric. |
| 73 | triples |
number |
MLB StatsAPI field or derived metric. |
| 74 | walks_per9_inn |
number |
MLB StatsAPI field or derived metric. |
| 75 | whip |
number |
MLB StatsAPI field or derived metric. |
| 76 | wild_pitches |
number |
MLB StatsAPI field or derived metric. |
| 77 | win_percentage |
string |
MLB StatsAPI field or derived metric. |
| 78 | wins |
number |
MLB StatsAPI field or derived metric. |
| 79 | extra_base_hits |
number |
Doubles + triples + 2 x home runs. |
| 80 | strikeout_rate |
number |
Strikeouts per plate appearance (batters) or per batter faced (pitchers). |
| 81 | walk_rate |
number |
Walks per plate appearance or batter faced. |
| 82 | home_run_rate |
number |
Home runs per plate appearance. |
| 83 | slg_minus_avg |
number |
Slugging percentage minus batting average (isolated power). |
| 84 | innings_pitched_decimal |
number |
Innings pitched converted to decimal (outs / 3). |
| 85 | ops_band |
string |
OPS band for batters. |
| 86 | era_band |
string |
ERA band for pitchers. |
| 87 | is_qualified_batter |
boolean |
true when the batter had 300+ plate appearances. |
| 88 | is_qualified_pitcher |
boolean |
true when the pitcher threw 100+ innings. |
π Support & Community
If you find this dataset valuable for your research, machine learning projects, or data explorations, please give it an upvote (π) on Kaggle! Feedback, questions, and community notebook submissions are warmly welcomed in the Discussions tab.
- Downloads last month
- 22