-
-
Notifications
You must be signed in to change notification settings - Fork 26.6k
FIX Improves nan support in LabelEncoder #22629
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
Conversation
|
Thanks. This seems really helpful. |
betatim
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you, @thomasjpfan.
Just a comment.
| dtype : data-type, default=None | ||
| Data type for `y`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the behavior of column_or_1d when dtype=None? Is it this one?
| dtype : data-type, default=None | |
| Data type for `y`. | |
| dtype : data-type, default=None | |
| Data type for `y`. | |
| When dtype is None, dtype is inferred from the elements of `y`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, it is inferred from the elements of y:
XREF: np.asarray docs
Reference Issues/PRs
Fixes #22628
What does this implement/fix? Explain your changes.
This makes
LabelEncoder.transformconvertyto the same dtype asclasses_before encoding it.Any other comments?
On
main, the behavior ofnaninLabelEncoderencodes thenaninfit_transform:This PR makes the behavior consistent with object dtypes.