pybaseball icon indicating copy to clipboard operation
pybaseball copied to clipboard

Player ID functions are not working as intended

Open jack-kelly-12 opened this issue 2 years ago • 5 comments

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.

jack-kelly-12 avatar May 22 '23 04:05 jack-kelly-12

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

tjburch avatar May 24 '23 00:05 tjburch

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

jack-kelly-12 avatar May 24 '23 21:05 jack-kelly-12

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?

tjburch avatar May 25 '23 14:05 tjburch

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

jack-kelly-12 avatar May 26 '23 20:05 jack-kelly-12

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]"

22celii avatar Jul 07 '23 21:07 22celii