Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated meta_from_soup_row to handle parsing names with two commas #277

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

snake-plissken
Copy link
Contributor

@snake-plissken snake-plissken commented Dec 21, 2016

Fix for issue BurntSushi/nfldb#214. Added a max-split parameter to the string's split function so that player names are split once.

This solves the issue of unpacking the parts of a name, but now technically the player names in the database will be kind of weird, since the player's suffix will be a part of the first name. See the name which causes the problem: Leno, Charles, Jr

Edit: Thought about the further fix on the train this morning and looked into what would happen when there is only one comma, like most player names contain. A name with one comma would cause a ValueError. For some reason I thought suffix would just come back as None if there wasn't a second comma.

Potentially a further fix could be:

name = tds[1].a.get_text().strip()
    if ',' not in name:
        last_name, first_name = name, ''
    else:
        last_name, first_name, suffix = map(lambda s: s.strip(), name.split(','))
        last_name = last_name + ', ' + suffix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant