Skip to content

Conversation

@MancusoM
Copy link
Contributor

This PR adds Statcast's Attack Zone tool to PyBaseball.

Run Values are a sabermetric tool used to measure offensive production. In 2019, the Baseball Savant added the ability to measure Run Values in a pre-defined "Attack Zone"

Run Values/Attack Zone Documentation: https://tangotiger.com/index.php/site/article/statcast-lab-swing-take-and-a-primer-on-run-value

In 2025, Atlanta Braves shortstop Ozzie Albies tallied -29 Runs in the Shadow Zone, last in the Majors


Changes Made:

  1. Added function statcast_pitcher_run_value in statcast_pitcher file

    • Added try/except/finally clause designed to return HTTP Error if website cannot be reached
    • Created Tests in test_statcast_pitcher to test function
  2. Added function statcast_batter_run_value in statcast_batter file

    • Added try/except/finally clause designed to return HTTP Error if website cannot to be reached
    • Created Tests in test_statcast_batter to test function
  3. General Improvements:

  • Fixed Issue within Baseball Savant Modules where the minimum queries were not formatted properly in the URL
  • Fixed several tests in statcast_pitcher, statcast_batter, statcast_fielding that were failing
    • These tests were failing on the number of columns returned, which was predefined, static, and stale once the Savant Team added the new columns to the Savant CSVs
  • Ran Ruff on Modules Changed
Used #430 as inspiration
This is my first open-source contribution anywhere so any feedback would be welcomed

@MancusoM MancusoM mentioned this pull request Sep 23, 2025
@schorrm
Copy link
Collaborator

schorrm commented Sep 25, 2025

Thank you!

@schorrm schorrm merged commit 114d72a into jldbc:master Sep 25, 2025
0 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants