Open
Description
Describe the issue:
When astype
ing a unit-less datetime64 NaT to the same type with specified unit, the unit is not preserved unlike the analgous operation for timedelta64
Reproduce the code example:
>>> import numpy as np
>>> np.__version__
'2.3.0.dev0+git20250301.dfb054e'
>>> np.timedelta64("nat")
np.timedelta64('NaT')
>>> np.timedelta64("nat").astype(np.dtype("timedelta64[ns]"))
np.timedelta64('NaT','ns')
>>> np.datetime64("nat")
np.datetime64('NaT')
>>> np.datetime64("nat").astype(np.dtype("datetime64[ns]"))
np.datetime64('NaT')
Error message:
Python and NumPy Versions:
'2.3.0.dev0+git20250301.dfb054e'
Runtime Environment:
No response
Context for the issue:
No response