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
datetime64.astype(datetime.datetime) returns int for dates in the far future #7945
The range for datetime64 may be larger, depending on the type.
When converting a datetime64 that is out of range for datetime.datetime, we get an integer back:
In [21]: future = datetime64(10**12, 's')
In [22]: print(future)
33658-09-27T01:46:40
In [23]: print(future.astype(datetime64))
33658-09-27T01:46:40
In [24]: print(future.astype(datetime.datetime))
1000000000000
Converting datetime64(NaT) returns None:
In [40]: print(datetime64('NaT').astype(datetime.datetime))
None
In both cases, this should probably raise some kind of warning or error, perhaps in agreement with numpys errstate (geterr/seterr) for invalid.
Activity