Skip to content

Commit 01115c4

Browse files
committed
Simplify diff
1 parent a65efb0 commit 01115c4

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

pandas/core/arrays/datetimelike.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,8 @@ def ceil(self, freq, ambiguous='raise', nonexistent='raise'):
346346
return self._round(freq, RoundTo.PLUS_INFTY, ambiguous, nonexistent)
347347

348348

349-
class DatetimeLikeArrayMixin(AttributesMixin,
350-
ExtensionOpsMixin,
349+
class DatetimeLikeArrayMixin(ExtensionOpsMixin,
350+
AttributesMixin,
351351
ExtensionArray):
352352
"""
353353
Shared Base/Mixin class for DatetimeArray, TimedeltaArray, PeriodArray

pandas/core/arrays/datetimes.py

+2-8
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
is_extension_type, is_float_dtype, is_int64_dtype, is_object_dtype,
2020
is_period_dtype, is_string_dtype, is_timedelta64_dtype, pandas_dtype)
2121
from pandas.core.dtypes.dtypes import DatetimeTZDtype
22-
from pandas.core.dtypes.generic import ABCPandasArray, ABCIndexClass, ABCSeries
22+
from pandas.core.dtypes.generic import ABCIndexClass, ABCPandasArray, ABCSeries
2323
from pandas.core.dtypes.missing import isna
2424

2525
from pandas.core import ops
@@ -286,13 +286,7 @@ def __init__(self, values, dtype=_NS_DTYPE, freq=None, copy=False):
286286
# We should consider requiring an actual dtype.
287287

288288
dtype = pandas_dtype(dtype)
289-
if (isinstance(dtype, np.dtype) and dtype != _NS_DTYPE
290-
or not isinstance(dtype, (np.dtype, DatetimeTZDtype))):
291-
msg = (
292-
"Unexpected value for 'dtype': '{}'. "
293-
"Must be 'datetime64[ns]' or DatetimeTZDtype'."
294-
)
295-
raise ValueError(msg.format(dtype))
289+
_validate_dt64_dtype(dtype)
296290

297291
if freq == "infer":
298292
msg = (

0 commit comments

Comments
 (0)