Add `isfinite` support for `datetime64` and `timedelta64`
See original GitHub issuenumpy.isfinite
should support datetime64
and timedelta64
objects. It should return True
for any ordinary value, and False
for datetime64('NaT')
and timedelta64('NaT')
.
As a side-effect, this will make isclose
and allclose
usable for datetime64
and timedelta64
objects.
In [97]: numpy.isfinite(numpy.datetime64(10**9, 's'))
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-97-8555b18406e5> in <module>()
----> 1 numpy.isfinite(numpy.datetime64(10**9, 's'))
TypeError: ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
Issue Analytics
- State:
- Created 9 years ago
- Reactions:6
- Comments:28 (17 by maintainers)
Top Results From Across the Web
MatPlotLib, datetimes, and TypeError: ufunc 'isfinite' not ...
The problem is, that the numpy ufunc isfinite is not defined for the numpy.datetime64 dtype. There is an effort to change this, though....
Read more >Datetimes and Timedeltas — NumPy v1.24 Manual
New in version 1.7.0. Starting in NumPy 1.7, there are core array data types which natively support datetime functionality. The data type is...
Read more >What's new in 1.4.0 (January 22, 2022) - Pandas
Add support for assigning values to by argument in DataFrame.plot.hist() and ... Bug in Index.insert() for inserting np.datetime64 , np.timedelta64 or tuple ...
Read more >Source code for bokeh.util.serialization - Bokeh documentation
Period) DATETIME_TYPES.add(type(pd.NaT)) NP_EPOCH = np.datetime64(0, 'ms') NP_MS_DELTA = np.timedelta64(1, 'ms') DT_EPOCH = dt.datetime.utcfromtimestamp(0) ...
Read more >Release Notes — Numba 0.56.4+0.g288a38bbd.dirty-py3.7 ...
PR #7047: Support __hash__ for numpy.datetime64 (Guilherme Leobas ... PR #7082: Added Add/Sub between datetime64 array and timedelta64 scalar (Nick ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I just hit this bug. I hope it can be fixed.
@eric-wieser Sure - make ndarray of datetime64 function more like first-class citizen will be welcome!