--- license: mit tags: - baseball - sports-analytics pretty_name: Don't scrape statcast data anymore --- # statcast-era-pitches This dataset contains every pitch thrown in Major League Baseball from 2015 through present, and is updated weekly. ## Why This data is available through the pybaseball pacakge and the baseballr package, however it is time consuming to re scrape statcast pitch level data each time you want / need to re run your code. This dataset solves this issue using github actions to automatically update itself each week throughout the baseball season. Reading the dataset directly from the huggingface url is way faster than rescraping your data each time. ## Usage ***Pandas*** ```python import pandas as pd df = pd.read_parquet("hf://datasets/Jensen-holm/statcast-era-pitches/data/statcast_era_pitches.parquet") ``` ***Duckdb*** ```sql SELECT * FROM 'hf://datasets/Jensen-holm/statcast-era-pitches/data/statcast_era_pitches.parquet'; ``` ***Polars*** ```python import polars as pl df = pl.read_parquet('hf://datasets/Jensen-holm/statcast-era-pitches/data/statcast_era_pitches.parquet') ``` ***HuggingFace Dataset*** ```python from datasets import load_dataset ds = load_dataset("Jensen-holm/statcast-era-pitches") ``` ***Tidyverse*** ```r library(tidyverse) statcast_pitches <- read_parquet( "https://huggingface.co/datasets/Jensen-holm/statcast-era-pitches/resolve/main/data/statcast_era_pitches.parquet" ) ``` ## Variable Docs Documentation on the columns/features in this dataset can be found [here](https://baseballsavant.mlb.com/csv-docs). ## Updates This data set is updated once per week through GitHub Actions in [this repository](https://github.com/Jensen-holm/statcast-era-pitches). the [pybaseball](https://github.com/jldbc/pybaseball) package is used to retrieve new statcast pitch level data each monday morning at 12:00 PM ET. It is then pushed to this huggingface dataset. ## Benchmarking ![dataset_load_times](dataset_load_times.png) | Load Time (s) | API | |---------------|-----| | 1421.103 | pybaseball | | 26.899 | polars | | 33.09332203865051 | pandas | | 68.69287300109863 | duckdb |