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
BUG: Timestamp landing on the NaT sentinel silently gave NaT (GH#66510)
A wall time whose int64 representation is exactly the NaT sentinel (-2**63)
came back as NaT, or as a Timestamp holding the sentinel that reported
pd.isna(...) as False while reading back as NaT once placed in a Series.
npy_datetimestruct_to_datetime returns the sentinel rather than raising, and
the later bounds checks are all skipped for NPY_NAT.
Also report an out-of-range shift to UTC as OutOfBoundsDatetime instead of
leaking a raw OverflowError from the int64 coercion.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: doc/source/whatsnew/v3.1.0.rst
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -334,6 +334,8 @@ Datetimelike
334
334
- Bug in :class:`ArrowExtensionArray` where adding a :class:`DateOffset` to a ``date32[pyarrow]`` or ``date64[pyarrow]`` Series raised an ``ArrowTypeError`` (:issue:`57168`)
335
335
- Bug in :class:`DatetimeIndex` constructor raising ``ValueError`` when passing equivalent but not equal frequencies (e.g. ``QS-FEB`` vs ``QS-MAY``) (:issue:`61086`)
336
336
- Bug in :class:`DatetimeIndex` raising ``AttributeError`` when comparing against Arrow date types (date32, date64) (:issue:`62051`)
337
+
- Bug in :class:`Timestamp` constructor and :meth:`Timestamp.replace` where a value landing exactly on the ``NaT`` sentinel — whether from a ``nanosecond`` or ``microsecond`` argument or from shifting a timezone-aware wall time to UTC — silently produced ``NaT`` (or a :class:`Timestamp` that reported itself as non-null but read back as ``NaT`` once placed in a :class:`Series`) instead of raising :class:`OutOfBoundsDatetime` (:issue:`66510`)
338
+
- Bug in :class:`Timestamp` constructor and :meth:`Timestamp.replace` where shifting a timezone-aware value to UTC past the representable range raised a raw ``OverflowError`` instead of :class:`OutOfBoundsDatetime`, e.g. ``Timestamp.max.replace(tzinfo=timezone(timedelta(hours=-9)))`` (:issue:`66510`)
337
339
- Bug in :class:`Timestamp` constructor where passing ``np.str_`` objects would fail in Cython string parsing (:issue:`48974`)
338
340
- Bug in :class:`Timestamp` constructor where strings with a negative year of fewer than 4 digits (e.g. ``"-111-01-01"``) silently dropped the leading ``"-"`` and were parsed as a positive year; BC dates with 1-4 digit years now parse correctly, matching :class:`numpy.datetime64` (:issue:`55954`)
339
341
- Bug in :class:`Timestamp` constructor, :class:`Timedelta` constructor, :func:`to_datetime`, and :func:`to_timedelta` with non-round ``float`` input and ``unit`` failing to raise when the value is just outside the representable bounds (:issue:`57366`)
0 commit comments