Draft Module
The draft module provides functions for accessing and displaying MLB and college baseball draft data for teams and players.
Functions
- parse_mlb_draft(year: int) list[dict]:
Parses MLB draft results from Baseball Almanac for a given year (1965–2025).
- Parameters:
year – Year of the draft.
- Returns:
List of drafted player details.
- get_drafted_players_mlb(team_name: str, year: int) list:
Retrieves a list of players from the specified team drafted to MLB in a given year.
- Parameters:
team_name – Name or substring of the team.
year – Year of the draft.
- Returns:
List of drafted player details.
- get_drafted_players_all_years_mlb(team_name: str) list:
Retrieves all MLB draft picks for a team across all available years.
- Parameters:
team_name – Name or substring of the team.
- Returns:
List of drafted player details.
- get_drafted_players_college(team_name: str, year: int) list:
Retrieves a list of players from the specified team drafted to college in a given year.
- Parameters:
team_name – Name or substring of the team.
year – Year of the draft.
- Returns:
List of drafted player details.
- get_drafted_players_all_years_college(team_name: str) list:
Retrieves all college draft picks for a team across all available years.
- Parameters:
team_name – Name or substring of the team.
- Returns:
List of drafted player details.
- print_draft_picks_mlb(picks: list) None
Prints formatted draft pick info from a list of draft dicts for MLB teams.
- Parameters:
picks – List of dictionaries, each representing an MLB draft pick with fields like “Year”, “Round”, “Pick”, “Player Name”, “POS”, and “Drafted From”.
- Returns:
None. Prints draft picks to the console.
- print_draft_picks_college(picks: list) None
Prints formatted draft pick info from a list of draft dicts for college teams.
- Parameters:
picks – List of dictionaries, each representing a college draft pick with fields like “Year”, “Round”, “Pick”, “Player Name”, “POS”, and “Drafted By”.
- Returns:
None. Prints draft picks to the console.
Usage Example
from ncaa_bbStats import get_drafted_players_college, get_drafted_players_all_years_college
# Example: All Northeastern draftees in the 2025 draft:
northeastern_2025 = get_drafted_players_college("Northeastern University", 2025)
print_draft_picks_college(northeastern_2025)
# Example: All Northeastern draftees since 1965:
northeastern_all = get_drafted_players_all_years_college("Northeastern University")
print(f"\nTotal picks from Northeastern: {len(northeastern_all)}")
from ncaa_bbStats import parse_mlb_draft
draft_2025 = parse_mlb_draft(2025)
# Print the top 5 picks
for pick in draft_2025[:5]:
print(pick)
Data Source
Team statistics are loaded from cached JSON files located in:
src/data/mlb_draft_cache/YYY.json
where YYYY is the year.