jldbc / pybaseball

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

Can't get playerid_lookup to work #333

Closed FudgeNuggets closed 1 year ago

FudgeNuggets commented 1 year ago

I've followed several online examples but the playerid_lookup function will not work for me. I run the cell in a jupyter notebook and get about 100 pages of errors.

Last example I tried:

from pybaseball import  playerid_lookup
from pybaseball import  statcast_pitcher
playerid_lookup('kershaw', 'clayton')

Gobs and gobs of errors pop up and I have no idea where to even start. The last error is: ValueError: Usecols do not match columns, columns expected but not found: ['mlb_played_last', 'key_bbref', 'key_retro', 'name_last', 'key_fangraphs', 'key_mlbam', 'name_first', 'mlb_played_first']

greenbeanbrown commented 1 year ago

FYI this is fixed in the git repo but not updated in their pip package.

You can use this command to update your package: pip install git+https://github.com/jldbc/pybaseball.git

tjburch commented 1 year ago

It's in pip now too as of 2.2.5.

FudgeNuggets commented 1 year ago

Thanks guys. I can get it to work in github but was trying to get it to work on my local machine. I've tried a couple of different computers without success. But at least I can get it to run here.

tjburch commented 1 year ago

How are you doing the install? On a machine that already has it maybe try:

pip install pybaseball --upgrade
python -c "import pybaseball; print(pybaseball.__version__)"

and see if it says 2.2.5

FudgeNuggets commented 1 year ago

I checked my version and it saya 2.2.5. But get this, I tried the same exact code in my local jupyter notebook today and it works like a champ. Didn't change a thing, didn't update anything, nothing... and it works exactly like it should today.

Weird.