Skip to content

[MRG] Improve error message for None values in OneHotEncoder and OrdinalEncoder #16713

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

Merged
merged 13 commits into from
Mar 21, 2020

Conversation

fferrin
Copy link
Contributor

@fferrin fferrin commented Mar 17, 2020

Reference Issues/PRs

Fixes #16702, #16703

What does this implement/fix? Explain your changes.

None input values were not checked when using OneHotEncoder and OrdinalEncoder. In this PR, a ValueErrorerror is raised in those cases.

Any other comments?

@TomDLT TomDLT changed the title Bug 16702 [MRG] Improve error message for None values in OneHotEncoder and OrdinalEncoder Mar 17, 2020
@fferrin
Copy link
Contributor Author

fferrin commented Mar 18, 2020

@jnothman ValueError was never raised when using None in the input. It goes directly to TypeError (Encoders require their input to be strings or numbers.), so I deleted it.

Copy link
Member

@jnothman jnothman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise LGTM

Copy link
Member

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like the error message to be more informative:

Copy link
Member

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks very much for the contribution.

@fferrin
Copy link
Contributor Author

fferrin commented Mar 21, 2020

Thanks @ogrisel and @jnothman for your help!

gio8tisu pushed a commit to gio8tisu/scikit-learn that referenced this pull request May 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Confusing error message in OneHotEncoder with None-encoded missing values
3 participants