jldbc / pybaseball

Pull current and historical baseball statistics using Python (Statcast, Baseball Reference, FanGraphs)
MIT License
1.19k stars 324 forks source link

Update playerid_lookup to account for common nicknames #260

Closed mhmills closed 2 years ago

mhmills commented 2 years ago

This pull request addresses issue #250 by accounting for names with common nicknames in the playerid_lookup() function. Previously, no data has been found when searching Yankees pitcher Michael King, but his data appeared under the name Mike King. This change accounts for that and other common nicknames -- for example somebody searching for Joe Votto would find the data for Joey Votto. I also added a test case for this in test_playerid_lookup.py.

Additionally, I updated pybaseball.__init__.py to match the changes made in pull request #251 (and that pull request should close issue #254); it was causing an ImportError for trying to import teams_core. The teams() function was replaced by teams_core in __init__.py but not in lahman.py, so I changed teams_core back to teams in the __init__.py.