BurntSushi / nfldb

A library to manage and update NFL data in a relational database.
The Unlicense
1.08k stars 264 forks source link

Player Name Error #214

Open ghost opened 7 years ago

ghost commented 7 years ago

It has to do with the extra "," in the name. Does anyone know a good way to work around that per chance?

Could not get player info from roster row:

72 Leno, Charles, Jr. T ACT 6'3" 305 10/9/1991 3 Boise State

Exception:

Traceback (most recent call last): File "C:\Anaconda2\lib\site-packages\nflgame\update_players.py", line 419, in run roster.append(meta_from_soup_row(team, row)) File "C:\Anaconda2\lib\site-packages\nflgame\update_players.py", line 179, in meta_from_soup_row last_name, first_name = map(lambda s: s.strip(), name.split(',')) ValueError: too many values to unpack

snake-plissken commented 7 years ago

The split function needs the second parameter to indicate how many times to split, and in this case we only want one split:

last_name, first_name = map(lambda s: s.strip(), name.split(',', 1))

Technically, it's an issue with https://github.com/BurntSushi/nflgame/

I'm actually kind of surprised this hasn't been an issue yet. I thought there were a few players with the Jr suffix (i.e. Duke Johnson Jr, Ted Ginn Jr). Turns out it's how they are listed at http://www.nfl.com/players/profile, and that name does not always match what is on the back of their jerseys. Right now it looks like Charles Leno Jr is the only active player in the NFL, officially, with a Jr suffix in his name. Also, he's been playing since 2014, so did he just change his name?

Edit: It looks like his name did change, at least according to Wikipedia: https://en.wikipedia.org/w/index.php?title=Charles_Leno_Jr.&diff=next&oldid=742096818

joeycortez42 commented 7 years ago

@snake-plissken You should probably make a pull request for that fix. It worked for me.

ghost commented 7 years ago

@nokemono42 Sorry I'm new to GitHub. I see someone issued a pull request for the fix. How do I get that branch?