Skip to main content

baseball-stats-python

A package that get baseball data from

Overview

Inspired by pybaseball. This pacakge is mainly focused on getting pitch-by-pitch data from Baseball Data Website like Baseball Savant and provide a easy way to get data for analytics.

Installation

Install the package via pip

pip install baseball-stats-python

Download the main branch by git clone

git clone https://github.com/ss77995ss/baseball-stats-python.git

pip with repository url

pip install git+https://github.com/ss77995ss/baseball-stats-python.git

Usage

statcast_search

Get pitch-by-pitch data from Baseball Savant with their search parameters. See documentation here.

from baseball_stats_python import statcast_search

# Get Dodgers's pitcher data in July 2024
statcast_search(
    season="2024",
    team='LAD',
    player_type='pitcher',
    month="7"
)

minor_statcast_search

Get pitch-by-pitch data from Baseball Savant's Minor League Statcast Search with their search parameters. See documentation here.

from baseball_stats_python import minor_statcast_search

# Get all pitch data in Triple-A in July 2024
minor_statcast_search(
    season="2024",
    level="AAA",
    month="7"
)

mlbam_id_search

Search for MLBAM ID(s) by player name. Can be used to get player ID for statcast_batter_search and statcast_pitcher_search. See documentation here.

from baseball_stats_python import (
    mlbam_id_search,
    statcast_batter_search,
    statcast_pitcher_search,
)

# Search for MLBAM ID(s) by player name
molina_mlbam_id = mlbam_id_search('Yadier Molina').iloc[0]['id']

# Get Yadier Molina's Statcast data
statcast_batter_search(batters_lookup=mlbam_id)

darvish_mlbam_id = mlbam_id_search('Yu Darvish').iloc[0]['id']

# Get Yu Darvish's Statcast data
statcast_pitcher_search(pitchers_lookup=darvish_mlbam_id)

fangraphs_search

Get batting or pitching leaderboard data from Fangraphs' major-league leaders API. fg_batting and fg_pitching are convenience wrappers for single-season queries. See documentation here.

from baseball_stats_python import fangraphs_search, fg_batting, fg_pitching

# Get the 2026 qualified batting leaderboard
fg_batting(season=2026)

# Get the 2026 qualified pitching leaderboard
fg_pitching(season=2026)

# Use fangraphs_search directly for multi-season or finer-grained queries
fangraphs_search(
    stats="bat",
    season1=2024,
    season=2026
)

Contributing

Welcome to open issues or pull requests to contribute to this project. Please read CONTRIBUTING.md for more details.

License

MIT License

Metadata

Release files for baseball-stats-python 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for baseball-stats-python 0.3.0
File Size Uploaded
baseball_stats_python-0.3.0.tar.gz 21.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for baseball-stats-python 0.3.0
File Interpreter ABI Platform
baseball_stats_python-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 42.5 kB

Release files / baseball_stats_python-0.3.0.tar.gz

Download URL baseball_stats_python-0.3.0.tar.gz
Size 21.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3b93fc6bfee0f726dca794471a3607eb3991855e1b3ee052f8ee519ebc6dc495
BLAKE2b-256 checksum
How to use checksums
dffd5ea6c8613c501a7a69be0594f5151197feebfa0c7d461c7866c0eae6ed80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 25, 2026.

Transparency log

Release files / baseball_stats_python-0.3.0-py3-none-any.whl

Download URL baseball_stats_python-0.3.0-py3-none-any.whl
Size 21.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
397b7487e91e0f09aa517ae69e60679834f7b9439a80e51a8d1236f671ecb08f
BLAKE2b-256 checksum
How to use checksums
d2ffd915b146e4085d86470dc8697b42fbeb10919eec1d6bde7fde9e39875500
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 25, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.5

1 release file

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page