Skip to main content

A python pacakge for getting baseball stats

Project description

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)

Contributing

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

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

baseball_stats_python-0.1.0.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

baseball_stats_python-0.1.0-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file baseball_stats_python-0.1.0.tar.gz.

File metadata

  • Download URL: baseball_stats_python-0.1.0.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for baseball_stats_python-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d9c474d102368250235095314fd2daaafc2aae7a74c22ec27983e046d50710a7
MD5 b3eaf1c23f65bf33d287f1f49e1b7594
BLAKE2b-256 7b115fce003908d76102685a5da1bbac7d354a768afe22a33afae47e92175623

See more details on using hashes here.

File details

Details for the file baseball_stats_python-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for baseball_stats_python-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2daa3c85089fd72e3402d8fe495d85dbb1aaeca1b5c8ec677ba2a7f722013805
MD5 dd402d3c57536345ffda1945a4ae9d2f
BLAKE2b-256 ca99eeca92ca3e1c8f0b45a43a5b6e12c486f2b751fd7651f5314a90b0f9cf84

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page