|
7 | 7 | from pandas.compat import string_types, text_type, PY3
|
8 | 8 | from .common import (_ensure_object, is_bool, is_integer, is_float,
|
9 | 9 | is_complex, is_datetimetz, is_categorical_dtype,
|
| 10 | + is_datetimelike, |
10 | 11 | is_extension_type, is_object_dtype,
|
11 | 12 | is_datetime64tz_dtype, is_datetime64_dtype,
|
12 | 13 | is_timedelta64_dtype, is_dtype_equal,
|
|
18 | 19 | _ensure_int8, _ensure_int16,
|
19 | 20 | _ensure_int32, _ensure_int64,
|
20 | 21 | _NS_DTYPE, _TD_DTYPE, _INT64_DTYPE,
|
21 |
| - _DATELIKE_DTYPES, _POSSIBLY_CAST_DTYPES) |
| 22 | + _POSSIBLY_CAST_DTYPES) |
22 | 23 | from .dtypes import ExtensionDtype
|
23 | 24 | from .generic import ABCDatetimeIndex, ABCPeriodIndex, ABCSeries
|
24 | 25 | from .missing import isnull, notnull
|
@@ -164,7 +165,7 @@ def _maybe_upcast_putmask(result, mask, other):
|
164 | 165 | # in np.place:
|
165 | 166 | # NaN -> NaT
|
166 | 167 | # integer or integer array -> date-like array
|
167 |
| - if result.dtype in _DATELIKE_DTYPES: |
| 168 | + if is_datetimelike(result.dtype): |
168 | 169 | if is_scalar(other):
|
169 | 170 | if isnull(other):
|
170 | 171 | other = result.dtype.type('nat')
|
@@ -666,7 +667,7 @@ def _possibly_castable(arr):
|
666 | 667 | # otherwise try to coerce
|
667 | 668 | kind = arr.dtype.kind
|
668 | 669 | if kind == 'M' or kind == 'm':
|
669 |
| - return arr.dtype in _DATELIKE_DTYPES |
| 670 | + return is_datetime64_dtype(arr.dtype) |
670 | 671 |
|
671 | 672 | return arr.dtype.name not in _POSSIBLY_CAST_DTYPES
|
672 | 673 |
|
|
0 commit comments