Skip to main content

A package to analyze college baseball stats by year and division

Project description

ncaa_bbStats (AKA CollegeBaseballStatsPackage)

ncaa_bbStats is an open-source Python package for retrieving, parsing, and analyzing Division I, II, and III college baseball team statistics (2002–2025). It also includes tools to retrieve and analyze MLB draft results of NCAA players. Built for sports analysts, developers, and fans, the package supports both live scraping from the NCAA stats site and cached JSON access for faster use.

Note
This project is under active development.


Documentation

Documentation is available at: ncaa_bbStats's ReadTheDocs

PyPI site: Link


Install

pip install ncaa_bbStats

Team Stats Module

Overview

This module enables you to extract season statistics for college baseball teams across all NCAA divisions. Some examples you can retrieve include:

Batting Stats: BA, HR, 2B, 3B, OBP, SLG

Pitching Stats: ERA, WHIP, K/9, SHO

Fielding Stats: FPCT, E, DP, TP

Retrieval Functions

get_team_stat(stat_name: str, team_name: str, year: int, division: int): Retrieves a specific statistic for a given team from the cached data
display_specific_team_stat(stat_name: str, search_team: str, year: int, division: int): Prints a specific statistic for a team in a readable format
display_team_stats(search_team: str, year: int, division: int): Displays all available statistics for a team for a given year and division

Statistical Analysis Functions

average_all_team_stats(year: int, division: int): Computes the average of all numeric values for each statistic across all teams
average_team_stat_str(stat_name: str, year: int, division: int): Returns a string representing the average value of a given statistic across all teams for the specified year and division
average_team_stat_float(stat_name: str, year: int, division: int): Returns a float representing the average value of a given statistic across all teams for the specified year and division
get_pythagenpat_expectation(team_name: str, year: int, division: int): Computes Pythagenpat expected win percentage and compares it with the actual win percentage
plot_team_stat_over_years(stat_name: str, team_name: str, division: int, start_year: int, end_year: int): Aggregates and plots a specified statistic for a team over a range of years

JSON Caching

Stats are stored in local JSON files (/data/team_stats_cache/) to enable fast offline access.

Draft Module

Overview

This module pulls MLB draft data for college baseball players and formats it for analysis.

Functions

parse_mlb_draft(year: int): Parses MLB draft results from Baseball Almanac for a given year (1965–2025)
get_drafted_players_mlb(team_name: str, year: int): Retrieves a list of players from the specified team drafted to MLB in a given year
get_drafted_players_all_years_mlb(team_name: str): Retrieves all MLB draft picks for a team across all available years
get_drafted_players_college(team_name: str, year: int): Retrieves a list of players from the specified team drafted to college in a given year
get_drafted_players_all_years_college(team_name: str): Retrieves all college draft picks for a team across all available years
print_draft_picks_mlb(picks: list): Prints MLB draft picks for a team in a given year in a readable format
print_draft_picks_college(picks: list): Prints college draft picks for a team in a given year in a readable format

Reference

Season Stats Reference

See full list of supported team statistics and their abbreviations in the Stats List.

Team Names

Refer to Team Name Reference for formatting options when passing team names.

Draft Team/School Names

Use the MLB Draft Name Reference for consistent naming of schools when using draft-related functions.

Planned Features

  • NCAA individual player stats

  • Team game results with win-loss tracking

  • Win probability models using in-game data

Contact

Feel free to reach out for collaboration or feedback: Mateo Biggs, mateojohn2024@gmail.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ncaa_bbstats-1.0.2.tar.gz (5.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ncaa_bbstats-1.0.2-py3-none-any.whl (5.5 MB view details)

Uploaded Python 3

File details

Details for the file ncaa_bbstats-1.0.2.tar.gz.

File metadata

  • Download URL: ncaa_bbstats-1.0.2.tar.gz
  • Upload date:
  • Size: 5.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for ncaa_bbstats-1.0.2.tar.gz
Algorithm Hash digest
SHA256 d22677abe7037d3504ca800308483ab403d33d7eafdb22aaeaf3b246a9fd276c
MD5 a70a32c9baa9589c6df4ddb2f4fe19c6
BLAKE2b-256 2c256bd25c91896f015631b96b6d5e54344448d42b3fa6d78a2a3ec29d16d971

See more details on using hashes here.

File details

Details for the file ncaa_bbstats-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: ncaa_bbstats-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for ncaa_bbstats-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fbdd100ad2d17424465416b34b046324aaa3524586922ae0c3d162f770c2f632
MD5 45168cd27401c73f97c5128f9f6692c1
BLAKE2b-256 516a23fe23e711f020dd5259d758af8484f1eec8f322cd805cb13a76d3532139

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page