You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BUG: np.timedelta64() and np.datetime64() do not raise any warning #31103
generic unit in timedelta64 dtype is deprecated in the PR gh-29619, but np.timedelta64() do not raise DeprecationWarning when called.
This is same for np.datetime64(), which returns NaT without unit.
Current behavior:
np.timedelta64() # no warning, returns 0 timedelta with generic unitnp.datetime64() # no warning, returns NaT without unit
It might be good to set some specific unit such as "ns" as default unit.
I'd like to note @seberg 's comment here for reference.
Rethinking it, there some subtleties. I.e. np.array([np.timedelta64(3, "ns")], dtype="m") needs to keep working the way it currently does.
That is in principle not so hard, but in practice the path it currently takes is still np.dtype("m") -> unitless singleton -> type(uniteless singleton). But if np.dtype("m") there gives a warning, this conversion needs to happen later.
changed the title [-]BUG: `np.timedelta64()` and `np.datetime64()` does not raise any warning[/-][+]BUG: `np.timedelta64()` and `np.datetime64()` do not raise any warning[/+]on Mar 30, 2026
Activity
[-]BUG: `np.timedelta64()` and `np.datetime64()` does not raise any warning[/-][+]BUG: `np.timedelta64()` and `np.datetime64()` do not raise any warning[/+]