-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
ENH: isfinite
support for datetime64
and timedelta64
#13218
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
I am not quite sure whether this should be done somewhat more elegant especially with the typeresolver.
Added test: test_datetime.TestDateTime.test_isfinite. It just checks the reverse of test_isnat.
I think quickly checking how to fix the isfinite version, we forgot that for histogram with automatic bins |
@seberg : That's true. I looked around a bit, and found the following:
As per my novice understanding, both |
I have made an attempt to get Should I submit a PR? |
None, | ||
TD(nodatetime_or_obj, out='?'), | ||
'PyUFunc_IsFiniteTypeResolver', | ||
TD(nodatetime_or_obj + times, out='?'), |
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.
Shorter as just noobj
(tested to be equivalent on my machine)
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.
Looks good to me - one tiny nit about the ufunc type letters.
isfinite
support for datetime64
and timedelta64
isfinite
support for datetime64
and timedelta64
Needs a release note. |
@debsankha ping. All this needs is a release note ( |
as per code review to `noobj`
`datetime64` and `timedelta64`
OK, done. |
Thanks @debsankha . |
This fixes #5610.
Works by adding a
PyUFunc_IsFiniteTypeResolver
forisfinite
ufunc. It does whatPyUFunc_IsNaTTypeResolver
does fordatetime64
andtimedelta64
objects, and callsPyUFunc_DefaultTypeResolver
for all other dtypes.