File size: 2,160 Bytes
a03f36a
 
c4aa093
 
 
 
a03f36a
69d38f1
 
 
335f93e
 
 
 
 
a7008bb
cee03a3
a7008bb
cee03a3
a7008bb
cee03a3
 
a7008bb
676a522
a7008bb
 
2e6ff94
 
 
 
 
 
 
cee03a3
 
 
 
 
676a522
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cee03a3
 
 
 
 
a7008bb
cee03a3
a7008bb
cee03a3
69d38f1
335f93e
ab1ea2a
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---
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 |