Skip to content

Commit 31526c7

Browse files
committed
fix: timedelta64 handling
1 parent 47ab487 commit 31526c7

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/zarr/core/dtype/npy/time.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,8 @@ def cast_scalar(self, data: object) -> np.timedelta64:
545545
raise a TypeError.
546546
"""
547547
if self._check_scalar(data):
548+
if isinstance(data, np.timedelta64) and np.isnan(data):
549+
return np.timedelta64("NaT", self.unit)
548550
return self._cast_scalar_unchecked(data)
549551
msg = (
550552
f"Cannot convert object {data!r} with type {type(data)} to a scalar compatible with the "

0 commit comments

Comments
 (0)