Skip to content

python-mlb-statsapi 1.1.1

Version 1.1.1 corrects numeric stat field handling.

Stats model fixes

Numeric rate and average fields such as avg, obp, slg, ops, era, and whip are now represented as floats instead of numeric strings.

Pydantic handles normal MLB numeric strings automatically:

from mlbstatsapi.models.stats.hitting import SimpleHittingSplit

stats = SimpleHittingSplit(avg=".287")

assert stats.avg == 0.287

The MLB Stats API also returns .--- and -.-- for unavailable rate statistics. These values are normalized to None.

MLB innings notation remains string-based because values such as "6.2" represent 6 2/3 innings rather than the decimal 6.2.

Python support

python-mlb-statsapi requires Python >=3.10.

CI validates Python 3.10 through 3.14 (3.10, 3.11, 3.12, 3.13, and 3.14).

This change builds on the investigation started in #241 and completed in #341.