jldbc / pybaseball

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

Player ID functions are not working as intended #363

Open jack-kelly-12 opened 1 year ago

jack-kelly-12 commented 1 year ago

I'm aware of the issues in the past few months with playerid_reverse_lookup() and playerid_lookup(), but I upgraded my pybaseball packages and am still having the issue. It is not returning the right data.

tjburch commented 1 year ago

Is it the same error shown in #337? Can you write the error, pybaseball version number, python version, and OS?

jack-kelly-12 commented 1 year ago

Different error, but it was that same error before I manually changed the code like one fix told me to try. Now it returns data sometimes, but not the right data or not at all.

Pybaseball: 2.2.5 Python: 3.9.7 Windows 10

pybaseball pic

tjburch commented 1 year ago

It's last then first for the first one:

In [11]: playerid_lookup("alonso","pete")
Out[11]:
  name_last name_first  key_mlbam key_retro  key_bbref  key_fangraphs  mlb_played_first  mlb_played_last
0    alonso       pete     624413  alonp001  alonspe01          19251            2019.0           2023.0

I'm unable to replicate the other two examples. Are you running a bunch of these at the same time all at once?

jack-kelly-12 commented 1 year ago

No, running one at a time. My fault on the first example, I used your code here: pybaseball pic Any suggestions?

22celii commented 12 months ago

Trying to obtain a player's name by using "batter" playerID from the statcast table....

pb.playerid_reverse_lookup(666969)

KeyError: "None of [Index(['name_last', 'name_first', 'key_mlbam', 'key_retro', 'key_bbref',\n 'key_fangraphs', 'mlb_played_first', 'mlb_played_last'],\n dtype='object')] are in the [columns]"