MLB Bat Tracking Dataset (2024-2025)

Published: (February 23, 2026 at 12:30 AM EST)
3 min read
Source: Dev.to

Source: Dev.to

Introduction

I’ve published a Kaggle dataset containing MLB Bat Tracking metrics for the 2024 and 2025 seasons. This dataset provides swing speed, attack angle, and other bat tracking statistics that were introduced by MLB in 2024.

Dataset Link:

Dataset Overview

MLB Bat Tracking (2024-2025)

  • Batters: 452 batters (226 per season)
  • Columns: 19 columns
  • Seasons: 2024, 2025
  • Source: Baseball Savant (directly accessed, not via pybaseball)

What is Bat Tracking?

Bat Tracking is a new technology introduced by MLB in 2024 that measures swing metrics using high‑speed cameras. It provides insights into swing mechanics that were previously unavailable.

Key Metrics

MetricDescription
bat_speedSwing speed at contact (mph)
swing_lengthLength of swing path (feet)
squared_up_rateRate of optimal bat‑ball contact (0‑1)
attack_angleSwing plane angle (degrees)
blast_avgPercentage of swings with both high speed and optimal contact

Data Collection

This dataset was collected directly from Baseball Savant using custom scraping, as pybaseball does not yet support bat tracking data.

Data Source:

import pandas as pd
import requests
from bs4 import BeautifulSoup

# Example: Fetching 2024 bat tracking data
url = "https://baseballsavant.mlb.com/leaderboard/bat-tracking?year=2024"
response = requests.get(url)
# Parse HTML and extract table data
# (Full implementation available in the dataset repository)

Dataset Schema

Main Columns

ColumnTypeDescription
yearintSeason year (2024 or 2025)
player_namestrPlayer name
player_idintMLBAM player ID
bat_speedfloatAverage bat speed (mph)
swing_lengthfloatAverage swing length (feet)
squared_up_ratefloatRate of squared‑up contact (0‑100%)
attack_anglefloatAverage attack angle (degrees)
blast_avgfloatBLAST score (0‑100)
fast_swing_ratefloatPercentage of fast swings (0‑100%)
swords_ratefloatPercentage of swings‑and‑misses in zone (0‑100%)

Usage in Kaggle Notebooks

Loading the Dataset

import pandas as pd

# Load bat tracking data
df = pd.read_csv('/kaggle/input/mlb-bat-tracking-2024-2025/bat_tracking_2024_2025.csv')

print(f"Total records: {len(df)}")
print(f"Seasons: {df['year'].unique()}")
print(f"Average bat speed: {df['bat_speed'].mean():.2f} mph")

Year‑over‑Year Comparison

import matplotlib.pyplot as plt

# Compare bat speed distribution between seasons
df_2024 = df[df['year'] == 2024]
df_2025 = df[df['year'] == 2025]

plt.hist(df_2024['bat_speed'], alpha=0.5, label='2024', bins=20)
plt.hist(df_2025['bat_speed'], alpha=0.5, label='2025', bins=20)
plt.xlabel('Bat Speed (mph)')
plt.ylabel('Frequency')
plt.legend()
plt.title('Bat Speed Distribution: 2024 vs 2025')
plt.show()

Analysis Examples

Top Performers by Bat Speed

# Top 10 fastest bat speeds in 2025
top_bat_speed = (
    df[df['year'] == 2025]
    .nlargest(10, 'bat_speed')[['player_name', 'bat_speed', 'squared_up_rate', 'attack_angle']]
)
print(top_bat_speed)

Squared‑Up Rate Analysis

import seaborn as sns
import matplotlib.pyplot as plt

# Relationship between bat speed and squared‑up rate
sns.scatterplot(data=df, x='bat_speed', y='squared_up_rate', hue='year', alpha=0.6)
plt.xlabel('Bat Speed (mph)')
plt.ylabel('Squared‑Up Rate (%)')
plt.title('Bat Speed vs Squared‑Up Rate')
plt.show()

Insights from Bat Tracking Data

What Makes a Good Hitter?

Bat tracking data reveals that elite hitters typically have:

  • High bat speed (75+ mph)
  • High squared‑up rate (30%+)
  • Optimal attack angle (10‑20° for most hitters)
  • Short swing length (efficient swing mechanics)

Comparing Swing Profiles

Different player types show distinct swing profiles:

  • Power hitters: High bat speed, steep attack angle
  • Contact hitters: Lower swing length, high squared‑up rate
  • Speed‑focused players: Fast swing rate, shallow attack angle
  • Dataset:
  • GitHub Repository:
  • Baseball Savant:
0 views
Back to Blog

Related posts

Read more »

A Discord Bot that Teaches ASL

This is a submission for the Built with Google Gemini: Writing Challengehttps://dev.to/challenges/mlh/built-with-google-gemini-02-25-26 What I Built with Google...

AWS who? Meet AAS

Introduction Predicting the downfall of SaaS and its providers is a popular theme, but this isn’t an AWS doomsday prophecy. AWS still commands roughly 30 % of...