data.search_player()

Substring-match player names against cached MLB rosters.

Usage

data.search_player(
    query,
    seasons_back=3,
)

Returns up to 50 matches with columns playerID, fullName, debutYear, finalYear. finalYear is "Active" for currently-active players, otherwise the most recent season the player was found on a roster (a proxy for their final season).

Walks rosters from the current season back through seasons_back prior seasons, returning on the first season that yields matches. Default seasons_back=3 gives fast typeahead for active and recently-retired players; pass a larger value for a deeper lookup (e.g. 29 to cover ~30 years of retirees).