|
9 | 9 |
|
10 | 10 | from pandas import (
|
11 | 11 | DatetimeIndex, Index, NaT, Period, Series, Timedelta, TimedeltaIndex,
|
12 |
| - Timestamp) |
| 12 | + Timestamp, isna) |
13 | 13 | from pandas.core.arrays import PeriodArray
|
14 | 14 | from pandas.util import testing as tm
|
15 | 15 |
|
@@ -201,9 +201,10 @@ def _get_overlap_public_nat_methods(klass, as_tuple=False):
|
201 | 201 | "fromtimestamp", "isocalendar", "isoformat", "isoweekday",
|
202 | 202 | "month_name", "now", "replace", "round", "strftime",
|
203 | 203 | "strptime", "time", "timestamp", "timetuple", "timetz",
|
204 |
| - "to_datetime64", "to_pydatetime", "today", "toordinal", |
205 |
| - "tz_convert", "tz_localize", "tzname", "utcfromtimestamp", |
206 |
| - "utcnow", "utcoffset", "utctimetuple", "weekday"]), |
| 204 | + "to_datetime64", "to_numpy", "to_pydatetime", "today", |
| 205 | + "toordinal", "tz_convert", "tz_localize", "tzname", |
| 206 | + "utcfromtimestamp", "utcnow", "utcoffset", "utctimetuple", |
| 207 | + "weekday"]), |
207 | 208 | (Timedelta, ["total_seconds"])
|
208 | 209 | ])
|
209 | 210 | def test_overlap_public_nat_methods(klass, expected):
|
@@ -339,3 +340,11 @@ def test_nat_arithmetic_td64_vector(op_name, box):
|
339 | 340 | def test_nat_pinned_docstrings():
|
340 | 341 | # see gh-17327
|
341 | 342 | assert NaT.ctime.__doc__ == datetime.ctime.__doc__
|
| 343 | + |
| 344 | + |
| 345 | +def test_to_numpy_alias(): |
| 346 | + # GH 24653: alias .to_numpy() for scalars |
| 347 | + expected = NaT.to_datetime64() |
| 348 | + result = NaT.to_numpy() |
| 349 | + |
| 350 | + assert isna(expected) and isna(result) |
0 commit comments