Upload mlb-player-seasons dataset files with full metadata
Browse files- KAGGLE.md +190 -0
- README.md +199 -0
- about.md +20 -0
- data_dictionary.csv +89 -0
- dataset-metadata.json +475 -0
- kernel-metadata.json +14 -0
- mlb_player_seasons.csv +0 -0
- notebook.ipynb +199 -0
KAGGLE.md
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MLB Player Seasons 2015-2025
|
| 2 |
+
|
| 3 |
+
**Subtitle:** 20,318 player-season rows with batting, pitching and fielding stats
|
| 4 |
+
|
| 5 |
+
**Tags:** `tabular`, `sports`, `baseball`
|
| 6 |
+
|
| 7 |
+
**Dataset File:** `mlb_player_seasons.csv` (20,318 rows, 88 columns, 5.8 MB)
|
| 8 |
+
|
| 9 |
+
**Provenance & Source:** MLB StatsAPI (statsapi.mlb.com)
|
| 10 |
+
|
| 11 |
+
**Expected Update Frequency:** `annually`
|
| 12 |
+
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
## 📖 Description
|
| 16 |
+
|
| 17 |
+
### MLB player seasons, 2015–2025
|
| 18 |
+
|
| 19 |
+
The MLB StatsAPI exposes season totals for every player. This dataset contains **20,318 player-season
|
| 20 |
+
rows** across **11 seasons**, with **88 parameters** — every statistic returned by the
|
| 21 |
+
API plus identity and derived rate fields.
|
| 22 |
+
|
| 23 |
+
- **Identity** — player id/name, team and league ids/names, season, position and group.
|
| 24 |
+
- **Hitting stats** — games, plate appearances, at-bats, runs, hits, doubles, triples, home runs, RBI,
|
| 25 |
+
walks, strikeouts, stolen bases, average, OBP, slugging, OPS, BABIP and more (blank for pitchers).
|
| 26 |
+
- **Pitching stats** — wins, losses, ERA, innings, strikeouts, saves, WHIP, home runs allowed, hit
|
| 27 |
+
batters and more (blank for batters).
|
| 28 |
+
- **Derived** — pitcher/batter flags, extra-base hits, strikeout/walk/HR rates, isolated power,
|
| 29 |
+
decimal innings, OPS and ERA bands, and qualification flags.
|
| 30 |
+
|
| 31 |
+
**11,350 batting rows** and **8,968 pitching rows** make this a complete two-way
|
| 32 |
+
player-season table for sabermetrics and fantasy analysis.
|
| 33 |
+
|
| 34 |
+
## 🧾 Columns (88)
|
| 35 |
+
|
| 36 |
+
`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`
|
| 37 |
+
|
| 38 |
+
## 💡 Ideas for using this data
|
| 39 |
+
|
| 40 |
+
1. **Two-way players** — find players with meaningful batting and pitching rows.
|
| 41 |
+
2. **Aging curves** — performance by age, separately for batters and pitchers.
|
| 42 |
+
3. **Power vs contact** — home-run rate vs strikeout rate.
|
| 43 |
+
4. **Team production** — aggregate team offence and pitching by season.
|
| 44 |
+
5. **Breakout seasons** — largest year-over-year improvements.
|
| 45 |
+
6. **Qualification effects** — how rate stats change when minimums are applied.
|
| 46 |
+
7. **Position scarcity** — offensive output by position.
|
| 47 |
+
8. **ERA vs WHIP** — pitcher profiles and outliers.
|
| 48 |
+
9. **Forecasting** — predict next-season OPS or ERA from prior seasons.
|
| 49 |
+
|
| 50 |
+
## 📁 Files
|
| 51 |
+
|
| 52 |
+
| File | What it is |
|
| 53 |
+
|---|---|
|
| 54 |
+
| `mlb_player_seasons.csv` | 20,318 player-seasons x 88 parameters. |
|
| 55 |
+
| `data_dictionary.csv` | Column / type / description for every field. |
|
| 56 |
+
| `notebook.ipynb` | Starter notebook that loads the CSV and analyses it. |
|
| 57 |
+
| `dataset-metadata.json` | Kaggle API metadata. |
|
| 58 |
+
| `about.md` | Plain-text About block. |
|
| 59 |
+
|
| 60 |
+
## 🏷️ Tags
|
| 61 |
+
|
| 62 |
+
`baseball`, `mlb`, `sports`, `statistics`, `players`, `sabermetrics`, `seasons`
|
| 63 |
+
|
| 64 |
+
## 🔗 Provenance
|
| 65 |
+
|
| 66 |
+
- **Source:** **MLB StatsAPI**,
|
| 67 |
+
`https://statsapi.mlb.com/api/v1/stats?stats=season&group={group}&season={year}&sportId=1`.
|
| 68 |
+
- **Scope:** all players with a season total in 2015–2025, for both hitting and pitching.
|
| 69 |
+
- **Processing:** every stat key retained and snake-cased; player/team/league/position identity joined;
|
| 70 |
+
rate, band and qualification fields derived.
|
| 71 |
+
- **Snapshot date:** 22 November 2026.
|
| 72 |
+
|
| 73 |
+
## 🔄 Update frequency
|
| 74 |
+
|
| 75 |
+
**Daily during the season.** StatsAPI updates statistics after each game.
|
| 76 |
+
|
| 77 |
+
## ⚠️ Caveats
|
| 78 |
+
|
| 79 |
+
- Stats are regular-season totals only; postseason is a separate endpoint.
|
| 80 |
+
- Players traded mid-season appear once per team in some responses, so rows are team-specific.
|
| 81 |
+
- Rate stats are not park- or league-adjusted.
|
| 82 |
+
- Innings pitched uses baseball notation (outs) and is converted to decimal for analysis.
|
| 83 |
+
- Very small sample sizes (few plate appearances) produce extreme rate stats.
|
| 84 |
+
- The API can revise statistics after the season.
|
| 85 |
+
- Column names follow the API's stat keys, snake-cased.
|
| 86 |
+
|
| 87 |
+
## �� Licence
|
| 88 |
+
|
| 89 |
+
MLB data is provided by MLB Advanced Media for public informational use.
|
| 90 |
+
|
| 91 |
+
### 📋 Column Definitions & File Header
|
| 92 |
+
|
| 93 |
+
| # | Column Name | Data Type | Description |
|
| 94 |
+
|---|---|---|---|
|
| 95 |
+
| 1 | `player_id` | `number` | MLB person identifier. |
|
| 96 |
+
| 2 | `player_name` | `string` | Player full name. |
|
| 97 |
+
| 3 | `team_id` | `number` | Team identifier. |
|
| 98 |
+
| 4 | `team_name` | `string` | Team name. |
|
| 99 |
+
| 5 | `league_id` | `number` | League identifier. |
|
| 100 |
+
| 6 | `league_name` | `string` | League name. |
|
| 101 |
+
| 7 | `season` | `number` | Season year. |
|
| 102 |
+
| 8 | `group` | `string` | hitting or pitching. |
|
| 103 |
+
| 9 | `position` | `string` | Position abbreviation. |
|
| 104 |
+
| 10 | `is_pitcher` | `boolean` | true for pitching rows. |
|
| 105 |
+
| 11 | `is_batter` | `boolean` | true for hitting rows. |
|
| 106 |
+
| 12 | `age` | `number` | MLB StatsAPI field or derived metric. |
|
| 107 |
+
| 13 | `air_outs` | `number` | MLB StatsAPI field or derived metric. |
|
| 108 |
+
| 14 | `at_bats` | `number` | MLB StatsAPI field or derived metric. |
|
| 109 |
+
| 15 | `at_bats_per_home_run` | `string` | MLB StatsAPI field or derived metric. |
|
| 110 |
+
| 16 | `avg` | `number` | MLB StatsAPI field or derived metric. |
|
| 111 |
+
| 17 | `babip` | `string` | MLB StatsAPI field or derived metric. |
|
| 112 |
+
| 18 | `balks` | `number` | MLB StatsAPI field or derived metric. |
|
| 113 |
+
| 19 | `base_on_balls` | `number` | MLB StatsAPI field or derived metric. |
|
| 114 |
+
| 20 | `batters_faced` | `number` | MLB StatsAPI field or derived metric. |
|
| 115 |
+
| 21 | `blown_saves` | `number` | MLB StatsAPI field or derived metric. |
|
| 116 |
+
| 22 | `catchers_interference` | `number` | MLB StatsAPI field or derived metric. |
|
| 117 |
+
| 23 | `caught_stealing` | `number` | MLB StatsAPI field or derived metric. |
|
| 118 |
+
| 24 | `caught_stealing_percentage` | `string` | MLB StatsAPI field or derived metric. |
|
| 119 |
+
| 25 | `complete_games` | `number` | MLB StatsAPI field or derived metric. |
|
| 120 |
+
| 26 | `doubles` | `number` | MLB StatsAPI field or derived metric. |
|
| 121 |
+
| 27 | `earned_runs` | `number` | MLB StatsAPI field or derived metric. |
|
| 122 |
+
| 28 | `era` | `number` | MLB StatsAPI field or derived metric. |
|
| 123 |
+
| 29 | `games_finished` | `number` | MLB StatsAPI field or derived metric. |
|
| 124 |
+
| 30 | `games_pitched` | `number` | MLB StatsAPI field or derived metric. |
|
| 125 |
+
| 31 | `games_played` | `number` | MLB StatsAPI field or derived metric. |
|
| 126 |
+
| 32 | `games_started` | `number` | MLB StatsAPI field or derived metric. |
|
| 127 |
+
| 33 | `ground_into_double_play` | `number` | MLB StatsAPI field or derived metric. |
|
| 128 |
+
| 34 | `ground_outs` | `number` | MLB StatsAPI field or derived metric. |
|
| 129 |
+
| 35 | `ground_outs_to_airouts` | `string` | MLB StatsAPI field or derived metric. |
|
| 130 |
+
| 36 | `hit_batsmen` | `number` | MLB StatsAPI field or derived metric. |
|
| 131 |
+
| 37 | `hit_by_pitch` | `number` | MLB StatsAPI field or derived metric. |
|
| 132 |
+
| 38 | `hits` | `number` | MLB StatsAPI field or derived metric. |
|
| 133 |
+
| 39 | `hits_per9_inn` | `number` | MLB StatsAPI field or derived metric. |
|
| 134 |
+
| 40 | `holds` | `number` | MLB StatsAPI field or derived metric. |
|
| 135 |
+
| 41 | `home_runs` | `number` | MLB StatsAPI field or derived metric. |
|
| 136 |
+
| 42 | `home_runs_per9` | `number` | MLB StatsAPI field or derived metric. |
|
| 137 |
+
| 43 | `inherited_runners` | `number` | MLB StatsAPI field or derived metric. |
|
| 138 |
+
| 44 | `inherited_runners_scored` | `number` | MLB StatsAPI field or derived metric. |
|
| 139 |
+
| 45 | `innings_pitched` | `number` | MLB StatsAPI field or derived metric. |
|
| 140 |
+
| 46 | `intentional_walks` | `number` | MLB StatsAPI field or derived metric. |
|
| 141 |
+
| 47 | `left_on_base` | `number` | MLB StatsAPI field or derived metric. |
|
| 142 |
+
| 48 | `losses` | `number` | MLB StatsAPI field or derived metric. |
|
| 143 |
+
| 49 | `number_of_pitches` | `number` | MLB StatsAPI field or derived metric. |
|
| 144 |
+
| 50 | `obp` | `number` | MLB StatsAPI field or derived metric. |
|
| 145 |
+
| 51 | `ops` | `number` | MLB StatsAPI field or derived metric. |
|
| 146 |
+
| 52 | `outs` | `number` | MLB StatsAPI field or derived metric. |
|
| 147 |
+
| 53 | `pickoffs` | `number` | MLB StatsAPI field or derived metric. |
|
| 148 |
+
| 54 | `pitches_per_inning` | `number` | MLB StatsAPI field or derived metric. |
|
| 149 |
+
| 55 | `plate_appearances` | `number` | MLB StatsAPI field or derived metric. |
|
| 150 |
+
| 56 | `rbi` | `number` | MLB StatsAPI field or derived metric. |
|
| 151 |
+
| 57 | `runs` | `number` | MLB StatsAPI field or derived metric. |
|
| 152 |
+
| 58 | `runs_scored_per9` | `number` | MLB StatsAPI field or derived metric. |
|
| 153 |
+
| 59 | `sac_bunts` | `number` | MLB StatsAPI field or derived metric. |
|
| 154 |
+
| 60 | `sac_flies` | `number` | MLB StatsAPI field or derived metric. |
|
| 155 |
+
| 61 | `save_opportunities` | `number` | MLB StatsAPI field or derived metric. |
|
| 156 |
+
| 62 | `saves` | `number` | MLB StatsAPI field or derived metric. |
|
| 157 |
+
| 63 | `shutouts` | `number` | MLB StatsAPI field or derived metric. |
|
| 158 |
+
| 64 | `slg` | `number` | MLB StatsAPI field or derived metric. |
|
| 159 |
+
| 65 | `stolen_base_percentage` | `string` | MLB StatsAPI field or derived metric. |
|
| 160 |
+
| 66 | `stolen_bases` | `number` | MLB StatsAPI field or derived metric. |
|
| 161 |
+
| 67 | `strike_outs` | `number` | MLB StatsAPI field or derived metric. |
|
| 162 |
+
| 68 | `strike_percentage` | `number` | MLB StatsAPI field or derived metric. |
|
| 163 |
+
| 69 | `strikeout_walk_ratio` | `string` | MLB StatsAPI field or derived metric. |
|
| 164 |
+
| 70 | `strikeouts_per9_inn` | `number` | MLB StatsAPI field or derived metric. |
|
| 165 |
+
| 71 | `strikes` | `number` | MLB StatsAPI field or derived metric. |
|
| 166 |
+
| 72 | `total_bases` | `number` | MLB StatsAPI field or derived metric. |
|
| 167 |
+
| 73 | `triples` | `number` | MLB StatsAPI field or derived metric. |
|
| 168 |
+
| 74 | `walks_per9_inn` | `number` | MLB StatsAPI field or derived metric. |
|
| 169 |
+
| 75 | `whip` | `number` | MLB StatsAPI field or derived metric. |
|
| 170 |
+
| 76 | `wild_pitches` | `number` | MLB StatsAPI field or derived metric. |
|
| 171 |
+
| 77 | `win_percentage` | `string` | MLB StatsAPI field or derived metric. |
|
| 172 |
+
| 78 | `wins` | `number` | MLB StatsAPI field or derived metric. |
|
| 173 |
+
| 79 | `extra_base_hits` | `number` | Doubles + triples + 2 x home runs. |
|
| 174 |
+
| 80 | `strikeout_rate` | `number` | Strikeouts per plate appearance (batters) or per batter faced (pitchers). |
|
| 175 |
+
| 81 | `walk_rate` | `number` | Walks per plate appearance or batter faced. |
|
| 176 |
+
| 82 | `home_run_rate` | `number` | Home runs per plate appearance. |
|
| 177 |
+
| 83 | `slg_minus_avg` | `number` | Slugging percentage minus batting average (isolated power). |
|
| 178 |
+
| 84 | `innings_pitched_decimal` | `number` | Innings pitched converted to decimal (outs / 3). |
|
| 179 |
+
| 85 | `ops_band` | `string` | OPS band for batters. |
|
| 180 |
+
| 86 | `era_band` | `string` | ERA band for pitchers. |
|
| 181 |
+
| 87 | `is_qualified_batter` | `boolean` | true when the batter had 300+ plate appearances. |
|
| 182 |
+
| 88 | `is_qualified_pitcher` | `boolean` | true when the pitcher threw 100+ innings. |
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
|
| 186 |
+
---
|
| 187 |
+
|
| 188 |
+
## 🌟 Support & Community
|
| 189 |
+
If you find this dataset valuable for your research, machine learning projects, or data explorations, **please give it an upvote (👍) on Kaggle!**
|
| 190 |
+
Feedback, questions, and community notebook submissions are warmly welcomed in the Discussions tab.
|
README.md
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
task_categories:
|
| 4 |
+
- tabular
|
| 5 |
+
tags:
|
| 6 |
+
- tabular
|
| 7 |
+
pretty_name: MLB Player Seasons 2015-2025
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# MLB Player Seasons 2015-2025
|
| 11 |
+
|
| 12 |
+
**Subtitle:** 20,318 player-season rows with batting, pitching and fielding stats
|
| 13 |
+
|
| 14 |
+
**Tags:** `tabular`, `sports`, `baseball`
|
| 15 |
+
|
| 16 |
+
**Dataset File:** `mlb_player_seasons.csv` (20,318 rows, 88 columns, 5.8 MB)
|
| 17 |
+
|
| 18 |
+
**Provenance & Source:** MLB StatsAPI (statsapi.mlb.com)
|
| 19 |
+
|
| 20 |
+
**Expected Update Frequency:** `annually`
|
| 21 |
+
|
| 22 |
+
---
|
| 23 |
+
|
| 24 |
+
## 📖 Description
|
| 25 |
+
|
| 26 |
+
### MLB player seasons, 2015–2025
|
| 27 |
+
|
| 28 |
+
The MLB StatsAPI exposes season totals for every player. This dataset contains **20,318 player-season
|
| 29 |
+
rows** across **11 seasons**, with **88 parameters** — every statistic returned by the
|
| 30 |
+
API plus identity and derived rate fields.
|
| 31 |
+
|
| 32 |
+
- **Identity** — player id/name, team and league ids/names, season, position and group.
|
| 33 |
+
- **Hitting stats** — games, plate appearances, at-bats, runs, hits, doubles, triples, home runs, RBI,
|
| 34 |
+
walks, strikeouts, stolen bases, average, OBP, slugging, OPS, BABIP and more (blank for pitchers).
|
| 35 |
+
- **Pitching stats** — wins, losses, ERA, innings, strikeouts, saves, WHIP, home runs allowed, hit
|
| 36 |
+
batters and more (blank for batters).
|
| 37 |
+
- **Derived** — pitcher/batter flags, extra-base hits, strikeout/walk/HR rates, isolated power,
|
| 38 |
+
decimal innings, OPS and ERA bands, and qualification flags.
|
| 39 |
+
|
| 40 |
+
**11,350 batting rows** and **8,968 pitching rows** make this a complete two-way
|
| 41 |
+
player-season table for sabermetrics and fantasy analysis.
|
| 42 |
+
|
| 43 |
+
## 🧾 Columns (88)
|
| 44 |
+
|
| 45 |
+
`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`
|
| 46 |
+
|
| 47 |
+
## 💡 Ideas for using this data
|
| 48 |
+
|
| 49 |
+
1. **Two-way players** — find players with meaningful batting and pitching rows.
|
| 50 |
+
2. **Aging curves** — performance by age, separately for batters and pitchers.
|
| 51 |
+
3. **Power vs contact** — home-run rate vs strikeout rate.
|
| 52 |
+
4. **Team production** — aggregate team offence and pitching by season.
|
| 53 |
+
5. **Breakout seasons** — largest year-over-year improvements.
|
| 54 |
+
6. **Qualification effects** — how rate stats change when minimums are applied.
|
| 55 |
+
7. **Position scarcity** — offensive output by position.
|
| 56 |
+
8. **ERA vs WHIP** — pitcher profiles and outliers.
|
| 57 |
+
9. **Forecasting** — predict next-season OPS or ERA from prior seasons.
|
| 58 |
+
|
| 59 |
+
## 📁 Files
|
| 60 |
+
|
| 61 |
+
| File | What it is |
|
| 62 |
+
|---|---|
|
| 63 |
+
| `mlb_player_seasons.csv` | 20,318 player-seasons x 88 parameters. |
|
| 64 |
+
| `data_dictionary.csv` | Column / type / description for every field. |
|
| 65 |
+
| `notebook.ipynb` | Starter notebook that loads the CSV and analyses it. |
|
| 66 |
+
| `dataset-metadata.json` | Kaggle API metadata. |
|
| 67 |
+
| `about.md` | Plain-text About block. |
|
| 68 |
+
|
| 69 |
+
## 🏷️ Tags
|
| 70 |
+
|
| 71 |
+
`baseball`, `mlb`, `sports`, `statistics`, `players`, `sabermetrics`, `seasons`
|
| 72 |
+
|
| 73 |
+
## 🔗 Provenance
|
| 74 |
+
|
| 75 |
+
- **Source:** **MLB StatsAPI**,
|
| 76 |
+
`https://statsapi.mlb.com/api/v1/stats?stats=season&group={group}&season={year}&sportId=1`.
|
| 77 |
+
- **Scope:** all players with a season total in 2015–2025, for both hitting and pitching.
|
| 78 |
+
- **Processing:** every stat key retained and snake-cased; player/team/league/position identity joined;
|
| 79 |
+
rate, band and qualification fields derived.
|
| 80 |
+
- **Snapshot date:** 22 November 2026.
|
| 81 |
+
|
| 82 |
+
## 🔄 Update frequency
|
| 83 |
+
|
| 84 |
+
**Daily during the season.** StatsAPI updates statistics after each game.
|
| 85 |
+
|
| 86 |
+
## ⚠️ Caveats
|
| 87 |
+
|
| 88 |
+
- Stats are regular-season totals only; postseason is a separate endpoint.
|
| 89 |
+
- Players traded mid-season appear once per team in some responses, so rows are team-specific.
|
| 90 |
+
- Rate stats are not park- or league-adjusted.
|
| 91 |
+
- Innings pitched uses baseball notation (outs) and is converted to decimal for analysis.
|
| 92 |
+
- Very small sample sizes (few plate appearances) produce extreme rate stats.
|
| 93 |
+
- The API can revise statistics after the season.
|
| 94 |
+
- Column names follow the API's stat keys, snake-cased.
|
| 95 |
+
|
| 96 |
+
## 📜 Licence
|
| 97 |
+
|
| 98 |
+
MLB data is provided by MLB Advanced Media for public informational use.
|
| 99 |
+
|
| 100 |
+
### 📋 Column Definitions & File Header
|
| 101 |
+
|
| 102 |
+
| # | Column Name | Data Type | Description |
|
| 103 |
+
|---|---|---|---|
|
| 104 |
+
| 1 | `player_id` | `number` | MLB person identifier. |
|
| 105 |
+
| 2 | `player_name` | `string` | Player full name. |
|
| 106 |
+
| 3 | `team_id` | `number` | Team identifier. |
|
| 107 |
+
| 4 | `team_name` | `string` | Team name. |
|
| 108 |
+
| 5 | `league_id` | `number` | League identifier. |
|
| 109 |
+
| 6 | `league_name` | `string` | League name. |
|
| 110 |
+
| 7 | `season` | `number` | Season year. |
|
| 111 |
+
| 8 | `group` | `string` | hitting or pitching. |
|
| 112 |
+
| 9 | `position` | `string` | Position abbreviation. |
|
| 113 |
+
| 10 | `is_pitcher` | `boolean` | true for pitching rows. |
|
| 114 |
+
| 11 | `is_batter` | `boolean` | true for hitting rows. |
|
| 115 |
+
| 12 | `age` | `number` | MLB StatsAPI field or derived metric. |
|
| 116 |
+
| 13 | `air_outs` | `number` | MLB StatsAPI field or derived metric. |
|
| 117 |
+
| 14 | `at_bats` | `number` | MLB StatsAPI field or derived metric. |
|
| 118 |
+
| 15 | `at_bats_per_home_run` | `string` | MLB StatsAPI field or derived metric. |
|
| 119 |
+
| 16 | `avg` | `number` | MLB StatsAPI field or derived metric. |
|
| 120 |
+
| 17 | `babip` | `string` | MLB StatsAPI field or derived metric. |
|
| 121 |
+
| 18 | `balks` | `number` | MLB StatsAPI field or derived metric. |
|
| 122 |
+
| 19 | `base_on_balls` | `number` | MLB StatsAPI field or derived metric. |
|
| 123 |
+
| 20 | `batters_faced` | `number` | MLB StatsAPI field or derived metric. |
|
| 124 |
+
| 21 | `blown_saves` | `number` | MLB StatsAPI field or derived metric. |
|
| 125 |
+
| 22 | `catchers_interference` | `number` | MLB StatsAPI field or derived metric. |
|
| 126 |
+
| 23 | `caught_stealing` | `number` | MLB StatsAPI field or derived metric. |
|
| 127 |
+
| 24 | `caught_stealing_percentage` | `string` | MLB StatsAPI field or derived metric. |
|
| 128 |
+
| 25 | `complete_games` | `number` | MLB StatsAPI field or derived metric. |
|
| 129 |
+
| 26 | `doubles` | `number` | MLB StatsAPI field or derived metric. |
|
| 130 |
+
| 27 | `earned_runs` | `number` | MLB StatsAPI field or derived metric. |
|
| 131 |
+
| 28 | `era` | `number` | MLB StatsAPI field or derived metric. |
|
| 132 |
+
| 29 | `games_finished` | `number` | MLB StatsAPI field or derived metric. |
|
| 133 |
+
| 30 | `games_pitched` | `number` | MLB StatsAPI field or derived metric. |
|
| 134 |
+
| 31 | `games_played` | `number` | MLB StatsAPI field or derived metric. |
|
| 135 |
+
| 32 | `games_started` | `number` | MLB StatsAPI field or derived metric. |
|
| 136 |
+
| 33 | `ground_into_double_play` | `number` | MLB StatsAPI field or derived metric. |
|
| 137 |
+
| 34 | `ground_outs` | `number` | MLB StatsAPI field or derived metric. |
|
| 138 |
+
| 35 | `ground_outs_to_airouts` | `string` | MLB StatsAPI field or derived metric. |
|
| 139 |
+
| 36 | `hit_batsmen` | `number` | MLB StatsAPI field or derived metric. |
|
| 140 |
+
| 37 | `hit_by_pitch` | `number` | MLB StatsAPI field or derived metric. |
|
| 141 |
+
| 38 | `hits` | `number` | MLB StatsAPI field or derived metric. |
|
| 142 |
+
| 39 | `hits_per9_inn` | `number` | MLB StatsAPI field or derived metric. |
|
| 143 |
+
| 40 | `holds` | `number` | MLB StatsAPI field or derived metric. |
|
| 144 |
+
| 41 | `home_runs` | `number` | MLB StatsAPI field or derived metric. |
|
| 145 |
+
| 42 | `home_runs_per9` | `number` | MLB StatsAPI field or derived metric. |
|
| 146 |
+
| 43 | `inherited_runners` | `number` | MLB StatsAPI field or derived metric. |
|
| 147 |
+
| 44 | `inherited_runners_scored` | `number` | MLB StatsAPI field or derived metric. |
|
| 148 |
+
| 45 | `innings_pitched` | `number` | MLB StatsAPI field or derived metric. |
|
| 149 |
+
| 46 | `intentional_walks` | `number` | MLB StatsAPI field or derived metric. |
|
| 150 |
+
| 47 | `left_on_base` | `number` | MLB StatsAPI field or derived metric. |
|
| 151 |
+
| 48 | `losses` | `number` | MLB StatsAPI field or derived metric. |
|
| 152 |
+
| 49 | `number_of_pitches` | `number` | MLB StatsAPI field or derived metric. |
|
| 153 |
+
| 50 | `obp` | `number` | MLB StatsAPI field or derived metric. |
|
| 154 |
+
| 51 | `ops` | `number` | MLB StatsAPI field or derived metric. |
|
| 155 |
+
| 52 | `outs` | `number` | MLB StatsAPI field or derived metric. |
|
| 156 |
+
| 53 | `pickoffs` | `number` | MLB StatsAPI field or derived metric. |
|
| 157 |
+
| 54 | `pitches_per_inning` | `number` | MLB StatsAPI field or derived metric. |
|
| 158 |
+
| 55 | `plate_appearances` | `number` | MLB StatsAPI field or derived metric. |
|
| 159 |
+
| 56 | `rbi` | `number` | MLB StatsAPI field or derived metric. |
|
| 160 |
+
| 57 | `runs` | `number` | MLB StatsAPI field or derived metric. |
|
| 161 |
+
| 58 | `runs_scored_per9` | `number` | MLB StatsAPI field or derived metric. |
|
| 162 |
+
| 59 | `sac_bunts` | `number` | MLB StatsAPI field or derived metric. |
|
| 163 |
+
| 60 | `sac_flies` | `number` | MLB StatsAPI field or derived metric. |
|
| 164 |
+
| 61 | `save_opportunities` | `number` | MLB StatsAPI field or derived metric. |
|
| 165 |
+
| 62 | `saves` | `number` | MLB StatsAPI field or derived metric. |
|
| 166 |
+
| 63 | `shutouts` | `number` | MLB StatsAPI field or derived metric. |
|
| 167 |
+
| 64 | `slg` | `number` | MLB StatsAPI field or derived metric. |
|
| 168 |
+
| 65 | `stolen_base_percentage` | `string` | MLB StatsAPI field or derived metric. |
|
| 169 |
+
| 66 | `stolen_bases` | `number` | MLB StatsAPI field or derived metric. |
|
| 170 |
+
| 67 | `strike_outs` | `number` | MLB StatsAPI field or derived metric. |
|
| 171 |
+
| 68 | `strike_percentage` | `number` | MLB StatsAPI field or derived metric. |
|
| 172 |
+
| 69 | `strikeout_walk_ratio` | `string` | MLB StatsAPI field or derived metric. |
|
| 173 |
+
| 70 | `strikeouts_per9_inn` | `number` | MLB StatsAPI field or derived metric. |
|
| 174 |
+
| 71 | `strikes` | `number` | MLB StatsAPI field or derived metric. |
|
| 175 |
+
| 72 | `total_bases` | `number` | MLB StatsAPI field or derived metric. |
|
| 176 |
+
| 73 | `triples` | `number` | MLB StatsAPI field or derived metric. |
|
| 177 |
+
| 74 | `walks_per9_inn` | `number` | MLB StatsAPI field or derived metric. |
|
| 178 |
+
| 75 | `whip` | `number` | MLB StatsAPI field or derived metric. |
|
| 179 |
+
| 76 | `wild_pitches` | `number` | MLB StatsAPI field or derived metric. |
|
| 180 |
+
| 77 | `win_percentage` | `string` | MLB StatsAPI field or derived metric. |
|
| 181 |
+
| 78 | `wins` | `number` | MLB StatsAPI field or derived metric. |
|
| 182 |
+
| 79 | `extra_base_hits` | `number` | Doubles + triples + 2 x home runs. |
|
| 183 |
+
| 80 | `strikeout_rate` | `number` | Strikeouts per plate appearance (batters) or per batter faced (pitchers). |
|
| 184 |
+
| 81 | `walk_rate` | `number` | Walks per plate appearance or batter faced. |
|
| 185 |
+
| 82 | `home_run_rate` | `number` | Home runs per plate appearance. |
|
| 186 |
+
| 83 | `slg_minus_avg` | `number` | Slugging percentage minus batting average (isolated power). |
|
| 187 |
+
| 84 | `innings_pitched_decimal` | `number` | Innings pitched converted to decimal (outs / 3). |
|
| 188 |
+
| 85 | `ops_band` | `string` | OPS band for batters. |
|
| 189 |
+
| 86 | `era_band` | `string` | ERA band for pitchers. |
|
| 190 |
+
| 87 | `is_qualified_batter` | `boolean` | true when the batter had 300+ plate appearances. |
|
| 191 |
+
| 88 | `is_qualified_pitcher` | `boolean` | true when the pitcher threw 100+ innings. |
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
---
|
| 196 |
+
|
| 197 |
+
## 🌟 Support & Community
|
| 198 |
+
If you find this dataset valuable for your research, machine learning projects, or data explorations, **please give it an upvote (👍) on Kaggle!**
|
| 199 |
+
Feedback, questions, and community notebook submissions are warmly welcomed in the Discussions tab.
|
about.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MLB Player Seasons 2015–2025
|
| 2 |
+
|
| 3 |
+
### MLB player seasons, 2015–2025
|
| 4 |
+
|
| 5 |
+
The MLB StatsAPI exposes season totals for every player. This dataset contains **20,318 player-season
|
| 6 |
+
rows** across **11 seasons**, with **88 parameters** — every statistic returned by the
|
| 7 |
+
API plus identity and derived rate fields.
|
| 8 |
+
|
| 9 |
+
- **Identity** — player id/name, team and league ids/names, season, position and group.
|
| 10 |
+
- **Hitting stats** — games, plate appearances, at-bats, runs, hits, doubles, triples, home runs, RBI,
|
| 11 |
+
walks, strikeouts, stolen bases, average, OBP, slugging, OPS, BABIP and more (blank for pitchers).
|
| 12 |
+
- **Pitching stats** — wins, losses, ERA, innings, strikeouts, saves, WHIP, home runs allowed, hit
|
| 13 |
+
batters and more (blank for batters).
|
| 14 |
+
- **Derived** — pitcher/batter flags, extra-base hits, strikeout/walk/HR rates, isolated power,
|
| 15 |
+
decimal innings, OPS and ERA bands, and qualification flags.
|
| 16 |
+
|
| 17 |
+
**11,350 batting rows** and **8,968 pitching rows** make this a complete two-way
|
| 18 |
+
player-season table for sabermetrics and fantasy analysis.
|
| 19 |
+
|
| 20 |
+
88 columns; 20,318 player-seasons x 88 parameters.
|
data_dictionary.csv
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
column,data_type,description
|
| 2 |
+
player_id,number,MLB person identifier.
|
| 3 |
+
player_name,string,Player full name.
|
| 4 |
+
team_id,number,Team identifier.
|
| 5 |
+
team_name,string,Team name.
|
| 6 |
+
league_id,number,League identifier.
|
| 7 |
+
league_name,string,League name.
|
| 8 |
+
season,number,Season year.
|
| 9 |
+
group,string,hitting or pitching.
|
| 10 |
+
position,string,Position abbreviation.
|
| 11 |
+
is_pitcher,boolean,true for pitching rows.
|
| 12 |
+
is_batter,boolean,true for hitting rows.
|
| 13 |
+
age,number,MLB StatsAPI field or derived metric.
|
| 14 |
+
air_outs,number,MLB StatsAPI field or derived metric.
|
| 15 |
+
at_bats,number,MLB StatsAPI field or derived metric.
|
| 16 |
+
at_bats_per_home_run,string,MLB StatsAPI field or derived metric.
|
| 17 |
+
avg,number,MLB StatsAPI field or derived metric.
|
| 18 |
+
babip,string,MLB StatsAPI field or derived metric.
|
| 19 |
+
balks,number,MLB StatsAPI field or derived metric.
|
| 20 |
+
base_on_balls,number,MLB StatsAPI field or derived metric.
|
| 21 |
+
batters_faced,number,MLB StatsAPI field or derived metric.
|
| 22 |
+
blown_saves,number,MLB StatsAPI field or derived metric.
|
| 23 |
+
catchers_interference,number,MLB StatsAPI field or derived metric.
|
| 24 |
+
caught_stealing,number,MLB StatsAPI field or derived metric.
|
| 25 |
+
caught_stealing_percentage,string,MLB StatsAPI field or derived metric.
|
| 26 |
+
complete_games,number,MLB StatsAPI field or derived metric.
|
| 27 |
+
doubles,number,MLB StatsAPI field or derived metric.
|
| 28 |
+
earned_runs,number,MLB StatsAPI field or derived metric.
|
| 29 |
+
era,number,MLB StatsAPI field or derived metric.
|
| 30 |
+
games_finished,number,MLB StatsAPI field or derived metric.
|
| 31 |
+
games_pitched,number,MLB StatsAPI field or derived metric.
|
| 32 |
+
games_played,number,MLB StatsAPI field or derived metric.
|
| 33 |
+
games_started,number,MLB StatsAPI field or derived metric.
|
| 34 |
+
ground_into_double_play,number,MLB StatsAPI field or derived metric.
|
| 35 |
+
ground_outs,number,MLB StatsAPI field or derived metric.
|
| 36 |
+
ground_outs_to_airouts,string,MLB StatsAPI field or derived metric.
|
| 37 |
+
hit_batsmen,number,MLB StatsAPI field or derived metric.
|
| 38 |
+
hit_by_pitch,number,MLB StatsAPI field or derived metric.
|
| 39 |
+
hits,number,MLB StatsAPI field or derived metric.
|
| 40 |
+
hits_per9_inn,number,MLB StatsAPI field or derived metric.
|
| 41 |
+
holds,number,MLB StatsAPI field or derived metric.
|
| 42 |
+
home_runs,number,MLB StatsAPI field or derived metric.
|
| 43 |
+
home_runs_per9,number,MLB StatsAPI field or derived metric.
|
| 44 |
+
inherited_runners,number,MLB StatsAPI field or derived metric.
|
| 45 |
+
inherited_runners_scored,number,MLB StatsAPI field or derived metric.
|
| 46 |
+
innings_pitched,number,MLB StatsAPI field or derived metric.
|
| 47 |
+
intentional_walks,number,MLB StatsAPI field or derived metric.
|
| 48 |
+
left_on_base,number,MLB StatsAPI field or derived metric.
|
| 49 |
+
losses,number,MLB StatsAPI field or derived metric.
|
| 50 |
+
number_of_pitches,number,MLB StatsAPI field or derived metric.
|
| 51 |
+
obp,number,MLB StatsAPI field or derived metric.
|
| 52 |
+
ops,number,MLB StatsAPI field or derived metric.
|
| 53 |
+
outs,number,MLB StatsAPI field or derived metric.
|
| 54 |
+
pickoffs,number,MLB StatsAPI field or derived metric.
|
| 55 |
+
pitches_per_inning,number,MLB StatsAPI field or derived metric.
|
| 56 |
+
plate_appearances,number,MLB StatsAPI field or derived metric.
|
| 57 |
+
rbi,number,MLB StatsAPI field or derived metric.
|
| 58 |
+
runs,number,MLB StatsAPI field or derived metric.
|
| 59 |
+
runs_scored_per9,number,MLB StatsAPI field or derived metric.
|
| 60 |
+
sac_bunts,number,MLB StatsAPI field or derived metric.
|
| 61 |
+
sac_flies,number,MLB StatsAPI field or derived metric.
|
| 62 |
+
save_opportunities,number,MLB StatsAPI field or derived metric.
|
| 63 |
+
saves,number,MLB StatsAPI field or derived metric.
|
| 64 |
+
shutouts,number,MLB StatsAPI field or derived metric.
|
| 65 |
+
slg,number,MLB StatsAPI field or derived metric.
|
| 66 |
+
stolen_base_percentage,string,MLB StatsAPI field or derived metric.
|
| 67 |
+
stolen_bases,number,MLB StatsAPI field or derived metric.
|
| 68 |
+
strike_outs,number,MLB StatsAPI field or derived metric.
|
| 69 |
+
strike_percentage,number,MLB StatsAPI field or derived metric.
|
| 70 |
+
strikeout_walk_ratio,string,MLB StatsAPI field or derived metric.
|
| 71 |
+
strikeouts_per9_inn,number,MLB StatsAPI field or derived metric.
|
| 72 |
+
strikes,number,MLB StatsAPI field or derived metric.
|
| 73 |
+
total_bases,number,MLB StatsAPI field or derived metric.
|
| 74 |
+
triples,number,MLB StatsAPI field or derived metric.
|
| 75 |
+
walks_per9_inn,number,MLB StatsAPI field or derived metric.
|
| 76 |
+
whip,number,MLB StatsAPI field or derived metric.
|
| 77 |
+
wild_pitches,number,MLB StatsAPI field or derived metric.
|
| 78 |
+
win_percentage,string,MLB StatsAPI field or derived metric.
|
| 79 |
+
wins,number,MLB StatsAPI field or derived metric.
|
| 80 |
+
extra_base_hits,number,Doubles + triples + 2 x home runs.
|
| 81 |
+
strikeout_rate,number,Strikeouts per plate appearance (batters) or per batter faced (pitchers).
|
| 82 |
+
walk_rate,number,Walks per plate appearance or batter faced.
|
| 83 |
+
home_run_rate,number,Home runs per plate appearance.
|
| 84 |
+
slg_minus_avg,number,Slugging percentage minus batting average (isolated power).
|
| 85 |
+
innings_pitched_decimal,number,Innings pitched converted to decimal (outs / 3).
|
| 86 |
+
ops_band,string,OPS band for batters.
|
| 87 |
+
era_band,string,ERA band for pitchers.
|
| 88 |
+
is_qualified_batter,boolean,true when the batter had 300+ plate appearances.
|
| 89 |
+
is_qualified_pitcher,boolean,true when the pitcher threw 100+ innings.
|
dataset-metadata.json
ADDED
|
@@ -0,0 +1,475 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"title": "MLB Player Seasons 2015-2025",
|
| 3 |
+
"id": "edudev-commons-org/mlb-player-seasons",
|
| 4 |
+
"subtitle": "20,318 player-season rows with batting, pitching and fielding stats",
|
| 5 |
+
"description": "# MLB Player Seasons 2015-2025\n\n**Subtitle:** 20,318 player-season rows with batting, pitching and fielding stats\n\n**Tags:** `tabular`, `sports`, `baseball`\n\n**Dataset File:** `mlb_player_seasons.csv` (20,318 rows, 88 columns, 5.8 MB)\n\n**Provenance & Source:** MLB StatsAPI (statsapi.mlb.com)\n\n**Expected Update Frequency:** `annually`\n\n---\n\n## \ud83d\udcd6 Description\n\n### MLB player seasons, 2015\u20132025\n\nThe MLB StatsAPI exposes season totals for every player. This dataset contains **20,318 player-season\nrows** across **11 seasons**, with **88 parameters** \u2014 every statistic returned by the\nAPI plus identity and derived rate fields.\n\n- **Identity** \u2014 player id/name, team and league ids/names, season, position and group.\n- **Hitting stats** \u2014 games, plate appearances, at-bats, runs, hits, doubles, triples, home runs, RBI,\n walks, strikeouts, stolen bases, average, OBP, slugging, OPS, BABIP and more (blank for pitchers).\n- **Pitching stats** \u2014 wins, losses, ERA, innings, strikeouts, saves, WHIP, home runs allowed, hit\n batters and more (blank for batters).\n- **Derived** \u2014 pitcher/batter flags, extra-base hits, strikeout/walk/HR rates, isolated power,\n decimal innings, OPS and ERA bands, and qualification flags.\n\n**11,350 batting rows** and **8,968 pitching rows** make this a complete two-way\nplayer-season table for sabermetrics and fantasy analysis.\n\n## \ud83e\uddfe Columns (88)\n\n`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`\n\n## \ud83d\udca1 Ideas for using this data\n\n1. **Two-way players** \u2014 find players with meaningful batting and pitching rows.\n2. **Aging curves** \u2014 performance by age, separately for batters and pitchers.\n3. **Power vs contact** \u2014 home-run rate vs strikeout rate.\n4. **Team production** \u2014 aggregate team offence and pitching by season.\n5. **Breakout seasons** \u2014 largest year-over-year improvements.\n6. **Qualification effects** \u2014 how rate stats change when minimums are applied.\n7. **Position scarcity** \u2014 offensive output by position.\n8. **ERA vs WHIP** \u2014 pitcher profiles and outliers.\n9. **Forecasting** \u2014 predict next-season OPS or ERA from prior seasons.\n\n## \ud83d\udcc1 Files\n\n| File | What it is |\n|---|---|\n| `mlb_player_seasons.csv` | 20,318 player-seasons x 88 parameters. |\n| `data_dictionary.csv` | Column / type / description for every field. |\n| `notebook.ipynb` | Starter notebook that loads the CSV and analyses it. |\n| `dataset-metadata.json` | Kaggle API metadata. |\n| `about.md` | Plain-text About block. |\n\n## \ud83c\udff7\ufe0f Tags\n\n`baseball`, `mlb`, `sports`, `statistics`, `players`, `sabermetrics`, `seasons`\n\n## \ud83d\udd17 Provenance\n\n- **Source:** **MLB StatsAPI**,\n `https://statsapi.mlb.com/api/v1/stats?stats=season&group={group}&season={year}&sportId=1`.\n- **Scope:** all players with a season total in 2015\u20132025, for both hitting and pitching.\n- **Processing:** every stat key retained and snake-cased; player/team/league/position identity joined;\n rate, band and qualification fields derived.\n- **Snapshot date:** 22 November 2026.\n\n## \ud83d\udd04 Update frequency\n\n**Daily during the season.** StatsAPI updates statistics after each game.\n\n## \u26a0\ufe0f Caveats\n\n- Stats are regular-season totals only; postseason is a separate endpoint.\n- Players traded mid-season appear once per team in some responses, so rows are team-specific.\n- Rate stats are not park- or league-adjusted.\n- Innings pitched uses baseball notation (outs) and is converted to decimal for analysis.\n- Very small sample sizes (few plate appearances) produce extreme rate stats.\n- The API can revise statistics after the season.\n- Column names follow the API's stat keys, snake-cased.\n\n## \ud83d\udcdc Licence\n\nMLB data is provided by MLB Advanced Media for public informational use.\n\n### \ud83d\udccb Column Definitions & File Header\n\n| # | Column Name | Data Type | Description |\n|---|---|---|---|\n| 1 | `player_id` | `number` | MLB person identifier. |\n| 2 | `player_name` | `string` | Player full name. |\n| 3 | `team_id` | `number` | Team identifier. |\n| 4 | `team_name` | `string` | Team name. |\n| 5 | `league_id` | `number` | League identifier. |\n| 6 | `league_name` | `string` | League name. |\n| 7 | `season` | `number` | Season year. |\n| 8 | `group` | `string` | hitting or pitching. |\n| 9 | `position` | `string` | Position abbreviation. |\n| 10 | `is_pitcher` | `boolean` | true for pitching rows. |\n| 11 | `is_batter` | `boolean` | true for hitting rows. |\n| 12 | `age` | `number` | MLB StatsAPI field or derived metric. |\n| 13 | `air_outs` | `number` | MLB StatsAPI field or derived metric. |\n| 14 | `at_bats` | `number` | MLB StatsAPI field or derived metric. |\n| 15 | `at_bats_per_home_run` | `string` | MLB StatsAPI field or derived metric. |\n| 16 | `avg` | `number` | MLB StatsAPI field or derived metric. |\n| 17 | `babip` | `string` | MLB StatsAPI field or derived metric. |\n| 18 | `balks` | `number` | MLB StatsAPI field or derived metric. |\n| 19 | `base_on_balls` | `number` | MLB StatsAPI field or derived metric. |\n| 20 | `batters_faced` | `number` | MLB StatsAPI field or derived metric. |\n| 21 | `blown_saves` | `number` | MLB StatsAPI field or derived metric. |\n| 22 | `catchers_interference` | `number` | MLB StatsAPI field or derived metric. |\n| 23 | `caught_stealing` | `number` | MLB StatsAPI field or derived metric. |\n| 24 | `caught_stealing_percentage` | `string` | MLB StatsAPI field or derived metric. |\n| 25 | `complete_games` | `number` | MLB StatsAPI field or derived metric. |\n| 26 | `doubles` | `number` | MLB StatsAPI field or derived metric. |\n| 27 | `earned_runs` | `number` | MLB StatsAPI field or derived metric. |\n| 28 | `era` | `number` | MLB StatsAPI field or derived metric. |\n| 29 | `games_finished` | `number` | MLB StatsAPI field or derived metric. |\n| 30 | `games_pitched` | `number` | MLB StatsAPI field or derived metric. |\n| 31 | `games_played` | `number` | MLB StatsAPI field or derived metric. |\n| 32 | `games_started` | `number` | MLB StatsAPI field or derived metric. |\n| 33 | `ground_into_double_play` | `number` | MLB StatsAPI field or derived metric. |\n| 34 | `ground_outs` | `number` | MLB StatsAPI field or derived metric. |\n| 35 | `ground_outs_to_airouts` | `string` | MLB StatsAPI field or derived metric. |\n| 36 | `hit_batsmen` | `number` | MLB StatsAPI field or derived metric. |\n| 37 | `hit_by_pitch` | `number` | MLB StatsAPI field or derived metric. |\n| 38 | `hits` | `number` | MLB StatsAPI field or derived metric. |\n| 39 | `hits_per9_inn` | `number` | MLB StatsAPI field or derived metric. |\n| 40 | `holds` | `number` | MLB StatsAPI field or derived metric. |\n| 41 | `home_runs` | `number` | MLB StatsAPI field or derived metric. |\n| 42 | `home_runs_per9` | `number` | MLB StatsAPI field or derived metric. |\n| 43 | `inherited_runners` | `number` | MLB StatsAPI field or derived metric. |\n| 44 | `inherited_runners_scored` | `number` | MLB StatsAPI field or derived metric. |\n| 45 | `innings_pitched` | `number` | MLB StatsAPI field or derived metric. |\n| 46 | `intentional_walks` | `number` | MLB StatsAPI field or derived metric. |\n| 47 | `left_on_base` | `number` | MLB StatsAPI field or derived metric. |\n| 48 | `losses` | `number` | MLB StatsAPI field or derived metric. |\n| 49 | `number_of_pitches` | `number` | MLB StatsAPI field or derived metric. |\n| 50 | `obp` | `number` | MLB StatsAPI field or derived metric. |\n| 51 | `ops` | `number` | MLB StatsAPI field or derived metric. |\n| 52 | `outs` | `number` | MLB StatsAPI field or derived metric. |\n| 53 | `pickoffs` | `number` | MLB StatsAPI field or derived metric. |\n| 54 | `pitches_per_inning` | `number` | MLB StatsAPI field or derived metric. |\n| 55 | `plate_appearances` | `number` | MLB StatsAPI field or derived metric. |\n| 56 | `rbi` | `number` | MLB StatsAPI field or derived metric. |\n| 57 | `runs` | `number` | MLB StatsAPI field or derived metric. |\n| 58 | `runs_scored_per9` | `number` | MLB StatsAPI field or derived metric. |\n| 59 | `sac_bunts` | `number` | MLB StatsAPI field or derived metric. |\n| 60 | `sac_flies` | `number` | MLB StatsAPI field or derived metric. |\n| 61 | `save_opportunities` | `number` | MLB StatsAPI field or derived metric. |\n| 62 | `saves` | `number` | MLB StatsAPI field or derived metric. |\n| 63 | `shutouts` | `number` | MLB StatsAPI field or derived metric. |\n| 64 | `slg` | `number` | MLB StatsAPI field or derived metric. |\n| 65 | `stolen_base_percentage` | `string` | MLB StatsAPI field or derived metric. |\n| 66 | `stolen_bases` | `number` | MLB StatsAPI field or derived metric. |\n| 67 | `strike_outs` | `number` | MLB StatsAPI field or derived metric. |\n| 68 | `strike_percentage` | `number` | MLB StatsAPI field or derived metric. |\n| 69 | `strikeout_walk_ratio` | `string` | MLB StatsAPI field or derived metric. |\n| 70 | `strikeouts_per9_inn` | `number` | MLB StatsAPI field or derived metric. |\n| 71 | `strikes` | `number` | MLB StatsAPI field or derived metric. |\n| 72 | `total_bases` | `number` | MLB StatsAPI field or derived metric. |\n| 73 | `triples` | `number` | MLB StatsAPI field or derived metric. |\n| 74 | `walks_per9_inn` | `number` | MLB StatsAPI field or derived metric. |\n| 75 | `whip` | `number` | MLB StatsAPI field or derived metric. |\n| 76 | `wild_pitches` | `number` | MLB StatsAPI field or derived metric. |\n| 77 | `win_percentage` | `string` | MLB StatsAPI field or derived metric. |\n| 78 | `wins` | `number` | MLB StatsAPI field or derived metric. |\n| 79 | `extra_base_hits` | `number` | Doubles + triples + 2 x home runs. |\n| 80 | `strikeout_rate` | `number` | Strikeouts per plate appearance (batters) or per batter faced (pitchers). |\n| 81 | `walk_rate` | `number` | Walks per plate appearance or batter faced. |\n| 82 | `home_run_rate` | `number` | Home runs per plate appearance. |\n| 83 | `slg_minus_avg` | `number` | Slugging percentage minus batting average (isolated power). |\n| 84 | `innings_pitched_decimal` | `number` | Innings pitched converted to decimal (outs / 3). |\n| 85 | `ops_band` | `string` | OPS band for batters. |\n| 86 | `era_band` | `string` | ERA band for pitchers. |\n| 87 | `is_qualified_batter` | `boolean` | true when the batter had 300+ plate appearances. |\n| 88 | `is_qualified_pitcher` | `boolean` | true when the pitcher threw 100+ innings. |\n\n\n\n---\n\n## \ud83c\udf1f Support & Community\nIf you find this dataset valuable for your research, machine learning projects, or data explorations, **please give it an upvote (\ud83d\udc4d) on Kaggle!**\nFeedback, questions, and community notebook submissions are warmly welcomed in the Discussions tab.\n",
|
| 6 |
+
"isPrivate": false,
|
| 7 |
+
"licenses": [
|
| 8 |
+
{
|
| 9 |
+
"name": "other"
|
| 10 |
+
}
|
| 11 |
+
],
|
| 12 |
+
"keywords": [
|
| 13 |
+
"tabular",
|
| 14 |
+
"sports",
|
| 15 |
+
"baseball"
|
| 16 |
+
],
|
| 17 |
+
"resources": [
|
| 18 |
+
{
|
| 19 |
+
"path": "mlb_player_seasons.csv",
|
| 20 |
+
"description": "Primary dataset file containing 20,318 records across 88 parameters.",
|
| 21 |
+
"schema": {
|
| 22 |
+
"fields": [
|
| 23 |
+
{
|
| 24 |
+
"name": "player_id",
|
| 25 |
+
"type": "number",
|
| 26 |
+
"description": "MLB person identifier."
|
| 27 |
+
},
|
| 28 |
+
{
|
| 29 |
+
"name": "player_name",
|
| 30 |
+
"type": "string",
|
| 31 |
+
"description": "Player full name."
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"name": "team_id",
|
| 35 |
+
"type": "number",
|
| 36 |
+
"description": "Team identifier."
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"name": "team_name",
|
| 40 |
+
"type": "string",
|
| 41 |
+
"description": "Team name."
|
| 42 |
+
},
|
| 43 |
+
{
|
| 44 |
+
"name": "league_id",
|
| 45 |
+
"type": "number",
|
| 46 |
+
"description": "League identifier."
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"name": "league_name",
|
| 50 |
+
"type": "string",
|
| 51 |
+
"description": "League name."
|
| 52 |
+
},
|
| 53 |
+
{
|
| 54 |
+
"name": "season",
|
| 55 |
+
"type": "number",
|
| 56 |
+
"description": "Season year."
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
"name": "group",
|
| 60 |
+
"type": "string",
|
| 61 |
+
"description": "hitting or pitching."
|
| 62 |
+
},
|
| 63 |
+
{
|
| 64 |
+
"name": "position",
|
| 65 |
+
"type": "string",
|
| 66 |
+
"description": "Position abbreviation."
|
| 67 |
+
},
|
| 68 |
+
{
|
| 69 |
+
"name": "is_pitcher",
|
| 70 |
+
"type": "boolean",
|
| 71 |
+
"description": "true for pitching rows."
|
| 72 |
+
},
|
| 73 |
+
{
|
| 74 |
+
"name": "is_batter",
|
| 75 |
+
"type": "boolean",
|
| 76 |
+
"description": "true for hitting rows."
|
| 77 |
+
},
|
| 78 |
+
{
|
| 79 |
+
"name": "age",
|
| 80 |
+
"type": "number",
|
| 81 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 82 |
+
},
|
| 83 |
+
{
|
| 84 |
+
"name": "air_outs",
|
| 85 |
+
"type": "number",
|
| 86 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 87 |
+
},
|
| 88 |
+
{
|
| 89 |
+
"name": "at_bats",
|
| 90 |
+
"type": "number",
|
| 91 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"name": "at_bats_per_home_run",
|
| 95 |
+
"type": "string",
|
| 96 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 97 |
+
},
|
| 98 |
+
{
|
| 99 |
+
"name": "avg",
|
| 100 |
+
"type": "number",
|
| 101 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 102 |
+
},
|
| 103 |
+
{
|
| 104 |
+
"name": "babip",
|
| 105 |
+
"type": "string",
|
| 106 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 107 |
+
},
|
| 108 |
+
{
|
| 109 |
+
"name": "balks",
|
| 110 |
+
"type": "number",
|
| 111 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 112 |
+
},
|
| 113 |
+
{
|
| 114 |
+
"name": "base_on_balls",
|
| 115 |
+
"type": "number",
|
| 116 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 117 |
+
},
|
| 118 |
+
{
|
| 119 |
+
"name": "batters_faced",
|
| 120 |
+
"type": "number",
|
| 121 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 122 |
+
},
|
| 123 |
+
{
|
| 124 |
+
"name": "blown_saves",
|
| 125 |
+
"type": "number",
|
| 126 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 127 |
+
},
|
| 128 |
+
{
|
| 129 |
+
"name": "catchers_interference",
|
| 130 |
+
"type": "number",
|
| 131 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 132 |
+
},
|
| 133 |
+
{
|
| 134 |
+
"name": "caught_stealing",
|
| 135 |
+
"type": "number",
|
| 136 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 137 |
+
},
|
| 138 |
+
{
|
| 139 |
+
"name": "caught_stealing_percentage",
|
| 140 |
+
"type": "string",
|
| 141 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 142 |
+
},
|
| 143 |
+
{
|
| 144 |
+
"name": "complete_games",
|
| 145 |
+
"type": "number",
|
| 146 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 147 |
+
},
|
| 148 |
+
{
|
| 149 |
+
"name": "doubles",
|
| 150 |
+
"type": "number",
|
| 151 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 152 |
+
},
|
| 153 |
+
{
|
| 154 |
+
"name": "earned_runs",
|
| 155 |
+
"type": "number",
|
| 156 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 157 |
+
},
|
| 158 |
+
{
|
| 159 |
+
"name": "era",
|
| 160 |
+
"type": "number",
|
| 161 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 162 |
+
},
|
| 163 |
+
{
|
| 164 |
+
"name": "games_finished",
|
| 165 |
+
"type": "number",
|
| 166 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 167 |
+
},
|
| 168 |
+
{
|
| 169 |
+
"name": "games_pitched",
|
| 170 |
+
"type": "number",
|
| 171 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 172 |
+
},
|
| 173 |
+
{
|
| 174 |
+
"name": "games_played",
|
| 175 |
+
"type": "number",
|
| 176 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 177 |
+
},
|
| 178 |
+
{
|
| 179 |
+
"name": "games_started",
|
| 180 |
+
"type": "number",
|
| 181 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 182 |
+
},
|
| 183 |
+
{
|
| 184 |
+
"name": "ground_into_double_play",
|
| 185 |
+
"type": "number",
|
| 186 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 187 |
+
},
|
| 188 |
+
{
|
| 189 |
+
"name": "ground_outs",
|
| 190 |
+
"type": "number",
|
| 191 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 192 |
+
},
|
| 193 |
+
{
|
| 194 |
+
"name": "ground_outs_to_airouts",
|
| 195 |
+
"type": "string",
|
| 196 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 197 |
+
},
|
| 198 |
+
{
|
| 199 |
+
"name": "hit_batsmen",
|
| 200 |
+
"type": "number",
|
| 201 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 202 |
+
},
|
| 203 |
+
{
|
| 204 |
+
"name": "hit_by_pitch",
|
| 205 |
+
"type": "number",
|
| 206 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 207 |
+
},
|
| 208 |
+
{
|
| 209 |
+
"name": "hits",
|
| 210 |
+
"type": "number",
|
| 211 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 212 |
+
},
|
| 213 |
+
{
|
| 214 |
+
"name": "hits_per9_inn",
|
| 215 |
+
"type": "number",
|
| 216 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 217 |
+
},
|
| 218 |
+
{
|
| 219 |
+
"name": "holds",
|
| 220 |
+
"type": "number",
|
| 221 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 222 |
+
},
|
| 223 |
+
{
|
| 224 |
+
"name": "home_runs",
|
| 225 |
+
"type": "number",
|
| 226 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 227 |
+
},
|
| 228 |
+
{
|
| 229 |
+
"name": "home_runs_per9",
|
| 230 |
+
"type": "number",
|
| 231 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 232 |
+
},
|
| 233 |
+
{
|
| 234 |
+
"name": "inherited_runners",
|
| 235 |
+
"type": "number",
|
| 236 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 237 |
+
},
|
| 238 |
+
{
|
| 239 |
+
"name": "inherited_runners_scored",
|
| 240 |
+
"type": "number",
|
| 241 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 242 |
+
},
|
| 243 |
+
{
|
| 244 |
+
"name": "innings_pitched",
|
| 245 |
+
"type": "number",
|
| 246 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 247 |
+
},
|
| 248 |
+
{
|
| 249 |
+
"name": "intentional_walks",
|
| 250 |
+
"type": "number",
|
| 251 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 252 |
+
},
|
| 253 |
+
{
|
| 254 |
+
"name": "left_on_base",
|
| 255 |
+
"type": "number",
|
| 256 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 257 |
+
},
|
| 258 |
+
{
|
| 259 |
+
"name": "losses",
|
| 260 |
+
"type": "number",
|
| 261 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 262 |
+
},
|
| 263 |
+
{
|
| 264 |
+
"name": "number_of_pitches",
|
| 265 |
+
"type": "number",
|
| 266 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 267 |
+
},
|
| 268 |
+
{
|
| 269 |
+
"name": "obp",
|
| 270 |
+
"type": "number",
|
| 271 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 272 |
+
},
|
| 273 |
+
{
|
| 274 |
+
"name": "ops",
|
| 275 |
+
"type": "number",
|
| 276 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 277 |
+
},
|
| 278 |
+
{
|
| 279 |
+
"name": "outs",
|
| 280 |
+
"type": "number",
|
| 281 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 282 |
+
},
|
| 283 |
+
{
|
| 284 |
+
"name": "pickoffs",
|
| 285 |
+
"type": "number",
|
| 286 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 287 |
+
},
|
| 288 |
+
{
|
| 289 |
+
"name": "pitches_per_inning",
|
| 290 |
+
"type": "number",
|
| 291 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 292 |
+
},
|
| 293 |
+
{
|
| 294 |
+
"name": "plate_appearances",
|
| 295 |
+
"type": "number",
|
| 296 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 297 |
+
},
|
| 298 |
+
{
|
| 299 |
+
"name": "rbi",
|
| 300 |
+
"type": "number",
|
| 301 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 302 |
+
},
|
| 303 |
+
{
|
| 304 |
+
"name": "runs",
|
| 305 |
+
"type": "number",
|
| 306 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 307 |
+
},
|
| 308 |
+
{
|
| 309 |
+
"name": "runs_scored_per9",
|
| 310 |
+
"type": "number",
|
| 311 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 312 |
+
},
|
| 313 |
+
{
|
| 314 |
+
"name": "sac_bunts",
|
| 315 |
+
"type": "number",
|
| 316 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 317 |
+
},
|
| 318 |
+
{
|
| 319 |
+
"name": "sac_flies",
|
| 320 |
+
"type": "number",
|
| 321 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 322 |
+
},
|
| 323 |
+
{
|
| 324 |
+
"name": "save_opportunities",
|
| 325 |
+
"type": "number",
|
| 326 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 327 |
+
},
|
| 328 |
+
{
|
| 329 |
+
"name": "saves",
|
| 330 |
+
"type": "number",
|
| 331 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 332 |
+
},
|
| 333 |
+
{
|
| 334 |
+
"name": "shutouts",
|
| 335 |
+
"type": "number",
|
| 336 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 337 |
+
},
|
| 338 |
+
{
|
| 339 |
+
"name": "slg",
|
| 340 |
+
"type": "number",
|
| 341 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 342 |
+
},
|
| 343 |
+
{
|
| 344 |
+
"name": "stolen_base_percentage",
|
| 345 |
+
"type": "string",
|
| 346 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 347 |
+
},
|
| 348 |
+
{
|
| 349 |
+
"name": "stolen_bases",
|
| 350 |
+
"type": "number",
|
| 351 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 352 |
+
},
|
| 353 |
+
{
|
| 354 |
+
"name": "strike_outs",
|
| 355 |
+
"type": "number",
|
| 356 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 357 |
+
},
|
| 358 |
+
{
|
| 359 |
+
"name": "strike_percentage",
|
| 360 |
+
"type": "number",
|
| 361 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 362 |
+
},
|
| 363 |
+
{
|
| 364 |
+
"name": "strikeout_walk_ratio",
|
| 365 |
+
"type": "string",
|
| 366 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 367 |
+
},
|
| 368 |
+
{
|
| 369 |
+
"name": "strikeouts_per9_inn",
|
| 370 |
+
"type": "number",
|
| 371 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 372 |
+
},
|
| 373 |
+
{
|
| 374 |
+
"name": "strikes",
|
| 375 |
+
"type": "number",
|
| 376 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 377 |
+
},
|
| 378 |
+
{
|
| 379 |
+
"name": "total_bases",
|
| 380 |
+
"type": "number",
|
| 381 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 382 |
+
},
|
| 383 |
+
{
|
| 384 |
+
"name": "triples",
|
| 385 |
+
"type": "number",
|
| 386 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 387 |
+
},
|
| 388 |
+
{
|
| 389 |
+
"name": "walks_per9_inn",
|
| 390 |
+
"type": "number",
|
| 391 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 392 |
+
},
|
| 393 |
+
{
|
| 394 |
+
"name": "whip",
|
| 395 |
+
"type": "number",
|
| 396 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 397 |
+
},
|
| 398 |
+
{
|
| 399 |
+
"name": "wild_pitches",
|
| 400 |
+
"type": "number",
|
| 401 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 402 |
+
},
|
| 403 |
+
{
|
| 404 |
+
"name": "win_percentage",
|
| 405 |
+
"type": "string",
|
| 406 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 407 |
+
},
|
| 408 |
+
{
|
| 409 |
+
"name": "wins",
|
| 410 |
+
"type": "number",
|
| 411 |
+
"description": "MLB StatsAPI field or derived metric."
|
| 412 |
+
},
|
| 413 |
+
{
|
| 414 |
+
"name": "extra_base_hits",
|
| 415 |
+
"type": "number",
|
| 416 |
+
"description": "Doubles + triples + 2 x home runs."
|
| 417 |
+
},
|
| 418 |
+
{
|
| 419 |
+
"name": "strikeout_rate",
|
| 420 |
+
"type": "number",
|
| 421 |
+
"description": "Strikeouts per plate appearance (batters) or per batter faced (pitchers)."
|
| 422 |
+
},
|
| 423 |
+
{
|
| 424 |
+
"name": "walk_rate",
|
| 425 |
+
"type": "number",
|
| 426 |
+
"description": "Walks per plate appearance or batter faced."
|
| 427 |
+
},
|
| 428 |
+
{
|
| 429 |
+
"name": "home_run_rate",
|
| 430 |
+
"type": "number",
|
| 431 |
+
"description": "Home runs per plate appearance."
|
| 432 |
+
},
|
| 433 |
+
{
|
| 434 |
+
"name": "slg_minus_avg",
|
| 435 |
+
"type": "number",
|
| 436 |
+
"description": "Slugging percentage minus batting average (isolated power)."
|
| 437 |
+
},
|
| 438 |
+
{
|
| 439 |
+
"name": "innings_pitched_decimal",
|
| 440 |
+
"type": "number",
|
| 441 |
+
"description": "Innings pitched converted to decimal (outs / 3)."
|
| 442 |
+
},
|
| 443 |
+
{
|
| 444 |
+
"name": "ops_band",
|
| 445 |
+
"type": "string",
|
| 446 |
+
"description": "OPS band for batters."
|
| 447 |
+
},
|
| 448 |
+
{
|
| 449 |
+
"name": "era_band",
|
| 450 |
+
"type": "string",
|
| 451 |
+
"description": "ERA band for pitchers."
|
| 452 |
+
},
|
| 453 |
+
{
|
| 454 |
+
"name": "is_qualified_batter",
|
| 455 |
+
"type": "boolean",
|
| 456 |
+
"description": "true when the batter had 300+ plate appearances."
|
| 457 |
+
},
|
| 458 |
+
{
|
| 459 |
+
"name": "is_qualified_pitcher",
|
| 460 |
+
"type": "boolean",
|
| 461 |
+
"description": "true when the pitcher threw 100+ innings."
|
| 462 |
+
}
|
| 463 |
+
]
|
| 464 |
+
}
|
| 465 |
+
},
|
| 466 |
+
{
|
| 467 |
+
"path": "data_dictionary.csv",
|
| 468 |
+
"description": "Field-level data dictionary detailing column names, data types, and semantic definitions."
|
| 469 |
+
},
|
| 470 |
+
{
|
| 471 |
+
"path": "notebook.ipynb",
|
| 472 |
+
"description": "Jupyter starter notebook providing exploratory data analysis and baseline visualizations."
|
| 473 |
+
}
|
| 474 |
+
]
|
| 475 |
+
}
|
kernel-metadata.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"id": "samyakrajbayar/mlb-player-seasons-analysis",
|
| 3 |
+
"title": "MLB Player Seasons 2015-2025 Analysis",
|
| 4 |
+
"code_file": "notebook.ipynb",
|
| 5 |
+
"language": "python",
|
| 6 |
+
"kernel_type": "notebook",
|
| 7 |
+
"is_private": false,
|
| 8 |
+
"enable_gpu": false,
|
| 9 |
+
"enable_tpu": false,
|
| 10 |
+
"enable_internet": true,
|
| 11 |
+
"dataset_sources": [
|
| 12 |
+
"edudev-commons-org/mlb-player-seasons"
|
| 13 |
+
]
|
| 14 |
+
}
|
mlb_player_seasons.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
notebook.ipynb
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"id": "98b2fa24",
|
| 6 |
+
"metadata": {},
|
| 7 |
+
"source": [
|
| 8 |
+
"# MLB Player Seasons 2015–2025\n",
|
| 9 |
+
"\n",
|
| 10 |
+
"Starter notebook for the Kaggle dataset in this folder. It loads `mlb_player_seasons.csv` with pandas and walks through quality checks and a first piece of analysis.\n",
|
| 11 |
+
"\n",
|
| 12 |
+
"**Files:** `mlb_player_seasons.csv`, `data_dictionary.csv`."
|
| 13 |
+
]
|
| 14 |
+
},
|
| 15 |
+
{
|
| 16 |
+
"cell_type": "markdown",
|
| 17 |
+
"id": "0000f7f2",
|
| 18 |
+
"metadata": {},
|
| 19 |
+
"source": [
|
| 20 |
+
"## 1. Load the data"
|
| 21 |
+
]
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"cell_type": "code",
|
| 25 |
+
"id": "195352f7",
|
| 26 |
+
"metadata": {},
|
| 27 |
+
"execution_count": null,
|
| 28 |
+
"outputs": [],
|
| 29 |
+
"source": [
|
| 30 |
+
"import pandas as pd\n",
|
| 31 |
+
"\n",
|
| 32 |
+
"df = pd.read_csv(\"mlb_player_seasons.csv\", low_memory=False)\n",
|
| 33 |
+
"print(df.shape)"
|
| 34 |
+
]
|
| 35 |
+
},
|
| 36 |
+
{
|
| 37 |
+
"cell_type": "markdown",
|
| 38 |
+
"id": "325de123",
|
| 39 |
+
"metadata": {},
|
| 40 |
+
"source": [
|
| 41 |
+
"## 2. Shape, types and missing values"
|
| 42 |
+
]
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"cell_type": "code",
|
| 46 |
+
"id": "6eb42bc8",
|
| 47 |
+
"metadata": {},
|
| 48 |
+
"execution_count": null,
|
| 49 |
+
"outputs": [],
|
| 50 |
+
"source": [
|
| 51 |
+
"print(f\"{df.shape[0]:,} rows x {df.shape[1]} columns\")\n",
|
| 52 |
+
"\n",
|
| 53 |
+
"missing = df.isna().mean().mul(100).sort_values(ascending=False)\n",
|
| 54 |
+
"missing[missing > 0].round(1).to_frame(\"missing_%\").head(15)"
|
| 55 |
+
]
|
| 56 |
+
},
|
| 57 |
+
{
|
| 58 |
+
"cell_type": "markdown",
|
| 59 |
+
"id": "f2d963fe",
|
| 60 |
+
"metadata": {},
|
| 61 |
+
"source": [
|
| 62 |
+
"## 3. Numeric summary"
|
| 63 |
+
]
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
"cell_type": "code",
|
| 67 |
+
"id": "aa2f8fd4",
|
| 68 |
+
"metadata": {},
|
| 69 |
+
"execution_count": null,
|
| 70 |
+
"outputs": [],
|
| 71 |
+
"source": [
|
| 72 |
+
"df.describe(include='number').T.round(2).head(20)"
|
| 73 |
+
]
|
| 74 |
+
},
|
| 75 |
+
{
|
| 76 |
+
"cell_type": "markdown",
|
| 77 |
+
"id": "f9ed7091",
|
| 78 |
+
"metadata": {},
|
| 79 |
+
"source": [
|
| 80 |
+
"## 4. Rows by group"
|
| 81 |
+
]
|
| 82 |
+
},
|
| 83 |
+
{
|
| 84 |
+
"cell_type": "code",
|
| 85 |
+
"id": "d9441e70",
|
| 86 |
+
"metadata": {},
|
| 87 |
+
"execution_count": null,
|
| 88 |
+
"outputs": [],
|
| 89 |
+
"source": [
|
| 90 |
+
"df[\"group\"].value_counts().to_frame(\"rows\")"
|
| 91 |
+
]
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"cell_type": "markdown",
|
| 95 |
+
"id": "831db828",
|
| 96 |
+
"metadata": {},
|
| 97 |
+
"source": [
|
| 98 |
+
"## 5. Top batting seasons"
|
| 99 |
+
]
|
| 100 |
+
},
|
| 101 |
+
{
|
| 102 |
+
"cell_type": "code",
|
| 103 |
+
"id": "350934d6",
|
| 104 |
+
"metadata": {},
|
| 105 |
+
"execution_count": null,
|
| 106 |
+
"outputs": [],
|
| 107 |
+
"source": [
|
| 108 |
+
"df[df[\"group\"] == \"hitting\"].nlargest(10, \"home_runs\")[[\"player_name\", \"season\", \"home_runs\", \"rbi\", \"ops\"]]"
|
| 109 |
+
]
|
| 110 |
+
},
|
| 111 |
+
{
|
| 112 |
+
"cell_type": "markdown",
|
| 113 |
+
"id": "56d80b05",
|
| 114 |
+
"metadata": {},
|
| 115 |
+
"source": [
|
| 116 |
+
"## 6. ERA distribution"
|
| 117 |
+
]
|
| 118 |
+
},
|
| 119 |
+
{
|
| 120 |
+
"cell_type": "code",
|
| 121 |
+
"id": "0531f72b",
|
| 122 |
+
"metadata": {},
|
| 123 |
+
"execution_count": null,
|
| 124 |
+
"outputs": [],
|
| 125 |
+
"source": [
|
| 126 |
+
"df.loc[df[\"group\"] == \"pitching\", \"era\"].apply(pd.to_numeric, errors=\"coerce\").dropna().clip(upper=10).hist(bins=40, figsize=(8, 4))"
|
| 127 |
+
]
|
| 128 |
+
},
|
| 129 |
+
{
|
| 130 |
+
"cell_type": "markdown",
|
| 131 |
+
"id": "a29efa6d",
|
| 132 |
+
"metadata": {},
|
| 133 |
+
"source": [
|
| 134 |
+
"## 7. OPS vs home runs"
|
| 135 |
+
]
|
| 136 |
+
},
|
| 137 |
+
{
|
| 138 |
+
"cell_type": "code",
|
| 139 |
+
"id": "17954b1d",
|
| 140 |
+
"metadata": {},
|
| 141 |
+
"execution_count": null,
|
| 142 |
+
"outputs": [],
|
| 143 |
+
"source": [
|
| 144 |
+
"sub = df[df[\"group\"] == \"hitting\"].dropna(subset=[\"ops\", \"home_runs\"])\n",
|
| 145 |
+
"sub.plot.scatter(x=\"home_runs\", y=\"ops\", s=5, alpha=0.25, figsize=(8, 5))"
|
| 146 |
+
]
|
| 147 |
+
},
|
| 148 |
+
{
|
| 149 |
+
"cell_type": "markdown",
|
| 150 |
+
"id": "a65559c0",
|
| 151 |
+
"metadata": {},
|
| 152 |
+
"source": [
|
| 153 |
+
"## 8. Age curve"
|
| 154 |
+
]
|
| 155 |
+
},
|
| 156 |
+
{
|
| 157 |
+
"cell_type": "code",
|
| 158 |
+
"id": "d2763d8c",
|
| 159 |
+
"metadata": {},
|
| 160 |
+
"execution_count": null,
|
| 161 |
+
"outputs": [],
|
| 162 |
+
"source": [
|
| 163 |
+
"sub = df[(df[\"group\"] == \"hitting\") & df[\"age\"].notna()]\n",
|
| 164 |
+
"sub.groupby(\"age\")[\"ops\"].mean().loc[20:40].plot(figsize=(9, 4))"
|
| 165 |
+
]
|
| 166 |
+
},
|
| 167 |
+
{
|
| 168 |
+
"cell_type": "markdown",
|
| 169 |
+
"id": "6e43770c",
|
| 170 |
+
"metadata": {},
|
| 171 |
+
"source": [
|
| 172 |
+
"## Next steps\n",
|
| 173 |
+
"\n",
|
| 174 |
+
"See `KAGGLE.md` for analysis ideas, caveats and provenance."
|
| 175 |
+
]
|
| 176 |
+
}
|
| 177 |
+
],
|
| 178 |
+
"metadata": {
|
| 179 |
+
"kernelspec": {
|
| 180 |
+
"display_name": "Python 3",
|
| 181 |
+
"language": "python",
|
| 182 |
+
"name": "python3"
|
| 183 |
+
},
|
| 184 |
+
"language_info": {
|
| 185 |
+
"name": "python",
|
| 186 |
+
"version": "3.11",
|
| 187 |
+
"mimetype": "text/x-python",
|
| 188 |
+
"file_extension": ".py",
|
| 189 |
+
"codemirror_mode": {
|
| 190 |
+
"name": "ipython",
|
| 191 |
+
"version": 3
|
| 192 |
+
},
|
| 193 |
+
"pygments_lexer": "ipython3",
|
| 194 |
+
"nbconvert_exporter": "python"
|
| 195 |
+
}
|
| 196 |
+
},
|
| 197 |
+
"nbformat": 4,
|
| 198 |
+
"nbformat_minor": 5
|
| 199 |
+
}
|