-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
BUG: nanmin/nanmax with object dtype comparing nans #28839
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
Comments
The reason is that we would have to define "isnan" for arbitrary objects in some sane way. I am actually pretty OK with defining it as something like So if you like that idea, you may be able to help nudge NumPy towards doing that :). (Of course |
Hmmm, there may also be an option of defining the
EDIT: Sorry, I realized that this still requires |
Curious what the reason is here - whether it's behavior or performance. |
I just don't really like special casing for a potentially long list of types. Next thing we notice that we have to also check for EDIT: There may be an argument that this special casing is less bad in |
I would propose the following definition of
I would certainly be opposed to That said, I'm not opposed to your proposal of Edit: One negative consequence of |
Uh oh!
There was an error while loading. Please reload this page.
Describe the issue:
When using
np.nanmin
ornp.nanmax
with object dtype, it appearsnan
values are being compared to non-nan
values. With the docstringI would expect no comparison here to be made and the operation successful. However I wonder if there could be pragmatic reasons to not want to support this operation.
This could be related to the following issues/PR, but it wasn't clear to me.
isfinite
, ...) #9009Reproduce the code example:
Error message:
Python and NumPy Versions:
NumPy: 2.2.5
Python: 3.12.3 (main, Feb 4 2025, 14:48:35) [GCC 13.3.0]
Runtime Environment:
Context for the issue:
This came up in pandas-dev/pandas#61204 (comment)
The text was updated successfully, but these errors were encountered: