-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Fix float->int casting with NaN, inf in check_array #14872
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
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.
I can't come up with a better solution, so LGTM.
Please add an entry to the change log at |
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.
Thanks Guillaume :)
I'll merge when it is green |
Closes #14871
Numpy rules when converting float to int convert NaN, inf to
np.iinfo(dtype).min/max
instead of raising an error. It would be good to address this in numpy somehow numpy/numpy#14412 but meanwhile we can manually apply_assert_all_finite
in this case (even withforce_all_finite=False
)cc @qinhanmin2014
TODO:
test_encoders.py
tests