Skip to content

Commit 692e4a0

Browse files
author
Chris Bertinato
committed
Added test for NaT
1 parent e7a5e15 commit 692e4a0

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

doc/source/whatsnew/v0.25.0.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Backwards incompatible API changes
3333
Other API Changes
3434
^^^^^^^^^^^^^^^^^
3535

36-
- ``Timestamp`` and ``Timedelta`` scalars now implement the :meth:`to_numpy` method as aliases to :meth:`Timestamp.to_datetime64` and :meth:`Timedelta.to_timedelta64`, respectively.
36+
- ``Timestamp`` and ``Timedelta`` scalars now implement the :meth:`to_numpy` method as aliases to :meth:`Timestamp.to_datetime64` and :meth:`Timedelta.to_timedelta64`, respectively. (:issue:`24653`)
3737

3838
-
3939
-

pandas/tests/scalar/test_nat.py

+5
Original file line numberDiff line numberDiff line change
@@ -339,3 +339,8 @@ def test_nat_arithmetic_td64_vector(op_name, box):
339339
def test_nat_pinned_docstrings():
340340
# see gh-17327
341341
assert NaT.ctime.__doc__ == datetime.ctime.__doc__
342+
343+
344+
def test_to_numpy_alias():
345+
# GH 24653: alias .to_numpy() for scalars
346+
assert NaT.to_datetime64() == NaT.to_numpy()

0 commit comments

Comments
 (0)