### Installing Python Dependencies (Bash) Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/CONTRIBUTING.md Install all required Python packages listed in the 'requirements.txt' file within the active virtual environment. ```Bash pip install -r requirements.txt ``` -------------------------------- ### Install baseball-stats-python via pip git URL (bash) Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/README.md Installs the baseball-stats-python package directly from its GitHub repository URL using pip. This provides an alternative way to install the latest version without manually cloning the repository first. ```bash pip install git+https://github.com/ss77995ss/baseball-stats-python.git ``` -------------------------------- ### Install baseball-stats-python via pip (bash) Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/README.md Installs the baseball-stats-python package from the Python Package Index (PyPI) using the pip package manager. This is the standard and recommended installation method. ```bash pip install baseball-stats-python ``` -------------------------------- ### Setting Up Python Virtual Environment (Bash) Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/CONTRIBUTING.md Install the venv module, create a new virtual environment named '.venv', and activate it to manage project dependencies separately. ```Bash pip install venv ``` ```Bash python -m venv .venv ``` ```Bash source venv/bin/activate ``` -------------------------------- ### Search Minor League Statcast data in Python Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/README.md Shows how to use the `minor_statcast_search` function to get pitch-by-pitch data specifically from Baseball Savant's Minor League section. The example retrieves all data for Triple-A in July 2024. ```python from baseball_stats_python import minor_statcast_search # Get all pitch data in Triple-A in July 2024 minor_statcast_search( season="2024", level="AAA", month="7" ) ``` -------------------------------- ### Install baseball-stats-python via git clone (bash) Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/README.md Clones the baseball-stats-python project repository from GitHub using the git command. This method is useful for obtaining the source code directly, potentially for development or installing the latest unreleased version. ```bash git clone https://github.com/ss77995ss/baseball-stats-python.git ``` -------------------------------- ### Running Code Linter (Bash) Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/CONTRIBUTING.md Run the ruff linter to check code for style guide violations, potential errors, and complexity issues. ```Bash ruff check ``` -------------------------------- ### Get Catcher Throwing Data (Python) Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/docs/runner_basestealing.md Demonstrates how to use the `catcher_throwing` function to retrieve catcher throwing data for a player, filtered by game type. Note: This example appears in documentation primarily focused on `runner_basestealing`. ```python # Get Shohei Ohtani's catcher throwing data in playoffs catcher_throwing('660271', game_type=GameType.PLAYOFFS) ``` -------------------------------- ### Searching for a Single Batter using statcast_batter_search (Python) Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/docs/statcast_search.md This example shows how to import and use the `statcast_batter_search` function to get pitch data for a single batter. The batter's lookup ID is passed as a string to the `batters_lookup` argument. This function is based on `statcast_search` but is limited to the `batters_lookup` filter. ```python from baseball_stats_python import statcast_batter_search # Get all pitch data of a specific batter statcast_batter_search( batters_lookup="660271" ) ``` -------------------------------- ### Searching Minor League Statcast Data by Date and Level (Python) Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/docs/minor_statcast_search.md Shows how to use the `minor_statcast_search` function to retrieve pitch data. Examples include filtering by month, a date range, and a specific minor league level (Triple-A). Requires the `baseball_stats_python` library. ```python from baseball_stats_python import minor_statcast_search # Get all pitch data in July 2024 minor_statcast_search( month="7" ) # Get all pitch data in two days minor_statcast_search( start_dt="2024-07-01", end_dt="2024-07-02" ) # Get all pitch data in Triple-A minor_statcast_search( level="AAA" ) ``` -------------------------------- ### Search Statcast data in Python Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/README.md Demonstrates how to use the `statcast_search` function to retrieve pitch-by-pitch data from Baseball Savant based on specified search parameters. The example filters for Dodgers pitchers in July 2024. ```python from baseball_stats_python import statcast_search # Get Dodgers's pitcher data in July 2024 statcast_search( season="2024", team='LAD', player_type='pitcher', month="7" ) ``` -------------------------------- ### Querying Pitcher Statcast Data with statcast_pitcher_search (Python) Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/docs/statcast_search.md Shows how to use the `statcast_pitcher_search` function, which is a specialized version of `statcast_search` focused on retrieving only pitcher data. This example filters data for a specific pitcher using their MLBAM ID. Requires the `baseball_stats_python` library. ```python from baseball_stats_python import statcast_pitcher_search # Get all pitch data of a specific pitcher statcast_pitcher_search( pitchers_lookup="669373" ) ``` -------------------------------- ### Getting Runner Extra Bases Taken Data (Python) Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/docs/runner_extra_bases_taken.md These examples demonstrate how to use the `runner_extra_bases_taken` function to fetch extra bases taken data for a specific runner from Baseball Savant. The function requires the runner's MLBAM ID and optionally accepts filters for season and game type. ```python from baseball_stats_python import runner_extra_bases_taken # Get Corbin Carroll's runner extra bases taken data runner_extra_bases_taken('682998') # Get Corbin Carroll's runner extra bases taken data in 2023 runner_extra_bases_taken('682998', season='2023') # Get Corbin Carroll's runner extra bases taken data in playoffs runner_extra_bases_taken('682998', game_type=GameType.PLAYOFFS) ``` -------------------------------- ### Querying Statcast Data with statcast_search (Python) Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/docs/statcast_search.md Demonstrates various ways to use the `statcast_search` function to retrieve pitch-level data. Examples show filtering by season, team, player type, date range, specific pitcher ID, and enabling debug output. This function requires the `baseball_stats_python` library. ```python from baseball_stats_python import statcast_search # Get Dodgers's pitcher data in July 2024 statcast_search( season="2024", team='LAD', player_type='pitcher', month="7" ) # Get all pitch data in two days statcast_search( start_dt="2024-07-01", end_dt="2024-07-02" ) # Get all pitch data of a specific pitcher # 669373 is Tarik Skubal's mlbam_id statcast_search( pitchers_lookup="669373" ) # Add debug=True to see more information statcast_search( pitchers_lookup="669373", debug=True ) ``` -------------------------------- ### Searching MLBAM IDs with baseball-stats-python (Python) Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/docs/mlbam_id_search.md These examples demonstrate how to use the `mlbam_id_search` function from the `baseball_stats_python` library. The first example shows how to search for players with a name similar to 'Reynolds', returning a DataFrame. The second example shows how to retrieve the specific MLBAM ID for 'Yadier Molina' by accessing the 'id' column of the first result. ```python from baseball_stats_python import mlbam_id_search # Get MLBAM IDs with name similar to "Reynolds" mlbam_id_search('Reynolds') # Get Yadier Molina's MLBAM ID mlbam_id_search('Molina').iloc[0]['id'] ``` -------------------------------- ### Querying Minor League Batter Statcast Data (Python) Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/docs/minor_statcast_search.md Illustrates how to import and use the `minor_statcast_batter_search` function to get statcast data for a specific batter. This function is similar to `minor_statcast_search` but is filtered by the `batters_lookup` argument, which must be provided with the batter's ID. ```python from baseball_stats_python import minor_statcast_batter_search # Get all pitch data of a specific batter minor_statcast_batter_search( batters_lookup="686611" ) ``` -------------------------------- ### Get Runner Basestealing Data (Python) Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/docs/runner_basestealing.md Demonstrates how to use the `runner_basestealing` function to retrieve baserunner stealing data for a runner, with options to filter by season. ```python from baseball_stats_python import runner_basestealing # Get Shohei Ohtani's runner basestealing data runner_basestealing('660271') ``` ```python # Get Shohei Ohtani's runner basestealing data in 2023 runner_basestealing('660271', season='2023') ``` -------------------------------- ### Project Dependencies List (requirements.txt) Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/requirements.txt This snippet contains the full list of Python packages required for the project, specified with exact versions. This file is used by package managers like pip to ensure a consistent environment by installing these dependencies. ```requirements.txt attrs==24.2.0 backports.tarfile==1.2.0 build==1.2.2.post1 cattrs==24.1.2 certifi==2024.8.30 cfgv==3.4.0 charset-normalizer==3.3.2 distlib==0.3.9 docutils==0.21.2 filelock==3.16.1 identify==2.6.1 idna==3.10 importlib_metadata==8.5.0 iniconfig==2.0.0 jaraco.classes==3.4.0 jaraco.context==6.0.1 jaraco.functools==4.1.0 keyring==25.4.1 markdown-it-py==3.0.0 mdurl==0.1.2 more-itertools==10.5.0 nh3==0.2.18 nodeenv==1.9.1 numpy==2.1.2 packaging==24.1 pandas==2.2.3 pkginfo==1.10.0 platformdirs==4.3.6 pluggy==1.5.0 pre_commit==4.0.1 Pygments==2.18.0 pyproject_hooks==1.2.0 pytest==8.3.3 python-dateutil==2.9.0.post0 pytz==2024.2 PyYAML==6.0.2 readme_renderer==44.0 requests==2.32.3 requests-cache==1.2.1 requests-toolbelt==1.0.0 rfc3986==2.0.0 rich==13.9.2 ruff==0.7.0 six==1.16.0 twine==5.1.1 tzdata==2024.2 url-normalize==1.4.3 urllib3==2.2.3 virtualenv==20.26.6 zipp==3.20.2 ``` -------------------------------- ### Cloning Repository and Adding Upstream Remote (Bash) Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/CONTRIBUTING.md Clone your forked repository to your local machine and add the original repository as an 'upstream' remote to sync changes. ```Bash git clone https://github.com//baseball-stats-python.git ``` ```Bash git remote add upstream https://github.com/ss77995ss/baseball-stats-python.git ``` -------------------------------- ### Syncing Fork with Upstream (Bash) Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/CONTRIBUTING.md Fetch the latest changes from the upstream repository's main branch and merge them into your local main branch to keep your fork up-to-date. ```Bash git fetch upstream main ``` ```Bash git pull upstream main ``` -------------------------------- ### Running Project Tests (Bash) Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/CONTRIBUTING.md Execute the project's test suite using pytest to ensure that code changes do not introduce regressions and new features work correctly. ```Bash pytest ``` -------------------------------- ### Committing Changes (Bash) Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/CONTRIBUTING.md Stage and save your changes to the local repository history with a descriptive commit message. ```Bash git commit -m "Add a brief message describing your changes" ``` -------------------------------- ### Pushing Changes to Remote Branch (Bash) Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/CONTRIBUTING.md Upload your local commits from the current branch to your remote fork on GitHub. ```Bash git push origin my-new-feature ``` -------------------------------- ### Creating New Feature Branch (Bash) Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/CONTRIBUTING.md Create and switch to a new branch for your specific feature or bug fix to isolate your changes. ```Bash git checkout -b my-new-feature ``` -------------------------------- ### Importing Minor League Pitcher Search Function (Python) Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/docs/minor_statcast_search.md Imports the `minor_statcast_pitcher_search` function from the `baseball_stats_python` library. This function is based on `minor_statcast_search` but is specifically tailored to return pitcher data. ```python from baseball_stats_python import minor_statcast_pitcher_search ``` -------------------------------- ### Querying Minor League Pitcher Statcast Data (Python) Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/docs/minor_statcast_search.md Demonstrates how to use the `minor_statcast_pitcher_search` function to retrieve statcast data for a specific pitcher. This function requires the `pitchers_lookup` argument, which specifies the pitcher's ID. It returns pitch data filtered by the provided pitcher ID. ```python minor_statcast_pitcher_search( pitchers_lookup="695549" ) ``` -------------------------------- ### Searching for Multiple Pitchers using statcast_pitcher_search (Python) Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/docs/statcast_search.md This snippet demonstrates how to use the `statcast_pitcher_search` function to retrieve data for multiple pitchers by providing a list of their lookup IDs to the `pitchers_lookup` argument. This function is a specialized version of `statcast_search` that only accepts the `pitchers_lookup` filter. ```python statcast_pitcher_search( pitchers_lookup=["669373", "808967"] ) ``` -------------------------------- ### Search MLBAM ID and player data in Python Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/README.md Illustrates the process of finding a player's MLBAM ID using `mlbam_id_search` and then using that ID to retrieve specific batter or pitcher Statcast data via `statcast_batter_search` or `statcast_pitcher_search`. ```python from baseball_stats_python import ( mlbam_id_search, statcast_batter_search, statcast_pitcher_search, ) # Search for MLBAM ID(s) by player name molina_mlbam_id = mlbam_id_search('Yadier Molina').iloc[0]['id'] # Get Yadier Molina's Statcast data statcast_batter_search(batters_lookup=molina_mlbam_id) darvish_mlbam_id = mlbam_id_search('Yu Darvish').iloc[0]['id'] # Get Yu Darvish's Statcast data statcast_pitcher_search(pitchers_lookup=darvish_mlbam_id) ``` -------------------------------- ### Using Enums for Minor League Statcast Search Filters (Python) Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/docs/minor_statcast_search.md Illustrates how to use the provided enums, such as `MinorGameType.PLAYOFFS` and `Level.AAA`, as arguments for the `minor_statcast_search` function. This provides a more structured way to specify filter values compared to using strings directly. Requires importing the specific enums. ```python from baseball_stats_python.enums.minor import MinorGameType, Level # Get playoff data minor_statcast_search( game_type=MinorGameType.PLAYOFFS ) # Get all pitch data in Triple-A using enum minor_statcast_search( level=Level.AAA ) ``` -------------------------------- ### Searching for Multiple Batters using statcast_batter_search (Python) Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/docs/statcast_search.md This snippet illustrates how to use the `statcast_batter_search` function to retrieve data for multiple batters. A list of batter lookup IDs is provided to the `batters_lookup` argument. Like its single-batter counterpart, this function is a specialized version of `statcast_search`. ```python statcast_batter_search( batters_lookup=["660271", "592450"] ) ``` -------------------------------- ### Using Enums with statcast_search (Python) Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/docs/statcast_search.md Illustrates how to use enum types like `GameType` and `MlbTeam` from the `baseball_stats_python.enums.statcast` module as parameters for the `statcast_search` function. This provides a more structured and type-safe way to specify filter values. Requires importing the specific enums. ```python from baseball_stats_python.enums.statcast import GameType, MlbTeam # Get Dodgers playoff data statcast_search( game_type=GameType.PLAYOFF, team=MlbTeam.DODGERS ) ``` -------------------------------- ### Retrieve Catcher Throwing Data (Python) Source: https://github.com/ss77995ss/baseball-stats-python/blob/main/docs/catcher_throwing.md Demonstrates how to use the `catcher_throwing` function to fetch data for a specific catcher, optionally filtering by season or game type. The function requires the catcher's MLBAM ID and can accept optional `season` (string) and `game_type` (string or GameType enum) arguments. It returns a DataFrame containing details for each stolen base attempt. ```python from baseball_stats_python import catcher_throwing # Get Will Smith's catcher throwing data catcher_throwing('669257') # Get Will Smith's catcher throwing data in 2023 catcher_throwing('669257', season='2023') # Get Will Smith's catcher throwing data in playoffs catcher_throwing('669257', game_type=GameType.PLAYOFFS) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.