Skip to content

Commit 2bc065e

Browse files
committed
feat(Statcast): Make 2025 season available in Statcast function to get spring training data
* Have to change it manually since Savant's default is still 2024 * Change default constant when Savant's change their default
1 parent 8d4f6e5 commit 2bc065e

4 files changed

Lines changed: 19 additions & 8 deletions

File tree

example.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@ def mlbam_id_example():
3232
print(df)
3333

3434

35+
def spring_training_example():
36+
df = statcast_search(
37+
season='2025',
38+
start_dt='2025-02-20',
39+
end_dt='2025-02-20',
40+
game_type='S',
41+
)
42+
print(df)
43+
44+
3545
# example()
3646
# minor_example()
3747
# mlbam_id_example()
48+
# spring_training_example()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.2.1'
1+
__version__ = '0.2.2'

src/baseball_stats_python/utils/minor.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
from ..constants import DEFAULT_SEASON
12
from ..enums.minor import Level, MinorGameType
23

3-
CURRENT_SEASON = 2024
44
START_SEASON = 2021
55

6-
ALL_SEASONS = [str(year) for year in range(START_SEASON, CURRENT_SEASON + 1)]
6+
# TODO: Remove 2025 once Baseball Savant changes their default season
7+
ALL_SEASONS = [str(year) for year in range(START_SEASON, 2025 + 1)]
78

89

910
def get_minor_season_param_str(season: str | list[str]) -> str:
@@ -16,7 +17,7 @@ def get_minor_season_param_str(season: str | list[str]) -> str:
1617
return '|'.join(season)
1718

1819
if season == '':
19-
return str(CURRENT_SEASON)
20+
return str(DEFAULT_SEASON)
2021
if season == 'all':
2122
return '|'.join(ALL_SEASONS)
2223

src/baseball_stats_python/utils/statcast.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44
START_SEASON = 2008
55
STATCAST_START_SEASON = 2015
66

7-
ALL_SEASONS = [str(year) for year in range(START_SEASON, DEFAULT_SEASON + 1)]
8-
STATCAST_SEASONS = [
9-
str(year) for year in range(STATCAST_START_SEASON, DEFAULT_SEASON + 1)
10-
]
7+
# TODO: Remove 2025 once Baseball Savant changes their default season
8+
ALL_SEASONS = [str(year) for year in range(START_SEASON, 2025 + 1)]
9+
STATCAST_SEASONS = [str(year) for year in range(STATCAST_START_SEASON, 2025 + 1)]
1110

1211

1312
def get_season_param_str(season: str | list[str]) -> str:

0 commit comments

Comments
 (0)