← All datasets

MLB Team Seasons

One row per MLB team per season from 1871 through 2021, 2,985 team-seasons built from the Lahman Baseball Database (Sean Lahman and the Chadwick Baseball Bureau, CC BY-SA 3.0). Thirty columns cover the full record: league and division, finish, games, wins, losses and win percentage, runs scored and allowed with the derived run differential, home runs, stolen bases, strikeouts, team ERA, shutouts, saves, errors and fielding percentage, flags for winning the division, the pennant and the World Series plus a made-the-postseason flag, attendance, ballpark and the batting and pitching park factors. It spans every major league the database records, from the 1870s National Association through the American Association and the Union, Players and Federal leagues to the modern National and American Leagues. A rich dataset for baseball analysis: the run differential to wins relationship (Pythagorean expectation), franchise trajectories across eras, offense and pitching trends, and attendance. Nine acceptance tests, one enforcing the 25 percent fill rule on every column.
2,985 rows 1 file last pulled 2026-10-24
Where would you start?
Pick a question, or ask your own and answer it; publish what you find as an insight. The same question can carry many insights from different angles.
  • Which franchises have the best all-time win percentage?
  • How often does the best record win the World Series?
  • Which eras had the most competitive balance across teams?
MLB Team Seasons 2,985 rows × 30 columns
Season_YearTeamFranchiseTeam_IDLeagueDivisionFinishGamesWinsLossesWin_PctRuns_ScoredRuns_AllowedRun_DifferentialHome_RunsStolen_BasesStrikeouts_BattingTeam_ERAShutoutsSavesErrorsFielding_PctMade_PostseasonWon_DivisionWon_PennantWon_World_SeriesAttendanceBallparkBatting_Park_FactorPitching_Park_Factor

Questions and answers

What is the MLB Team Seasons dataset?

One row per MLB team per season from 1871 through 2021, 2,985 team-seasons built from the Lahman Baseball Database (Sean Lahman and the Chadwick Baseball Bureau, CC BY-SA 3.0). Thirty columns cover the full record: league and division, finish, games, wins, losses and win percentage, runs scored and allowed with the derived run differential, home runs, stolen bases, strikeouts, team ERA, shutouts, saves, errors and fielding percentage, flags for winning the division, the pennant and the World Series plus a made-the-postseason flag, attendance, ballpark and the batting and pitching park factors. It spans every major league the database records, from the 1870s National Association through the American Association and the Union, Players and Federal leagues to the modern National and American Leagues. A rich dataset for baseball analysis: the run differential to wins relationship (Pythagorean expectation), franchise trajectories across eras, offense and pitching trends, and attendance. Nine acceptance tests, one enforcing the 25 percent fill rule on every column.

How big is the MLB Team Seasons dataset?

2,985 rows in one CSV file, with 30 columns in total: Season_Year, Team, Franchise, Team_ID, League, Division, Finish, Games, Wins, Losses, Win_Pct, Runs_Scored, Runs_Allowed, Run_Differential, Home_Runs, Stolen_Bases, Strikeouts_Batting, Team_ERA, Shutouts, Saves, Errors, Fielding_Pct, Made_Postseason, Won_Division, Won_Pennant, Won_World_Series, Attendance, Ballpark, Batting_Park_Factor, Pitching_Park_Factor.

Where does the data come from?

It is built by programmatically scraping github.com, last pulled on 2026-10-24. Datasets are versioned; older versions stay downloadable.

Is the dataset free to download?

Yes. Every CodeSights dataset is completely free as a CSV download; a free account is all it takes. Anyone can preview the data without signing in.

Can I see the code that built this dataset?

Yes. The exact Python scraper that built it is viewable on the dataset page by any signed-in member, so every number is reproducible.

Can the data contain errors?

Automated scraping leaves room for error and the underlying sources change over time, so no version is guaranteed accurate or complete. If a number matters, verify it against the original source.

Browse every free dataset on CodeSights