Skip to content

Commit 83db05c

Browse files
committed
updates
1 parent f07ab80 commit 83db05c

File tree

4 files changed

+10
-15
lines changed

4 files changed

+10
-15
lines changed

pandas/core/dtypes/base.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@ def type(self):
175175
"""The scalar type for the array, e.g. ``int``
176176
177177
It's expected ``ExtensionArray[item]`` returns an instance
178-
of ``ExtensionDtype.type`` for scalar ``item``.
178+
of ``ExtensionDtype.type`` for scalar ``item``, assuming
179+
that value is valid (not NA). NA values do not need to be
180+
instances of `type`.
179181
"""
180182
raise AbstractMethodError(self)
181183

pandas/core/dtypes/common.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from pandas.compat import (string_types, text_type, binary_type,
55
PY3, PY36)
66
from pandas._libs import algos, lib
7-
from pandas._libs.tslibs import conversion, Period
7+
from pandas._libs.tslibs import conversion, Period, Timestamp
88
from pandas._libs.interval import Interval
99

1010
from pandas.core.dtypes.dtypes import (
@@ -1915,7 +1915,7 @@ def _get_dtype_type(arr_or_dtype):
19151915
if is_categorical_dtype(arr_or_dtype):
19161916
return CategoricalDtypeType
19171917
elif is_datetime64tz_dtype(arr_or_dtype):
1918-
return DatetimeTZDtypeType
1918+
return Timestmap
19191919
elif is_period_dtype(arr_or_dtype):
19201920
return Period
19211921
elif is_interval_dtype(arr_or_dtype):

pandas/core/dtypes/dtypes.py

+2-9
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import numpy as np
55
from pandas import compat
66
from pandas.core.dtypes.generic import ABCIndexClass, ABCCategoricalIndex
7-
from pandas._libs.tslibs import Period, NaT
7+
from pandas._libs.tslibs import Period, NaT, Timestamp
88
from pandas._libs.interval import Interval
99

1010
from .base import ExtensionDtype, _DtypeOpsMixin
@@ -471,13 +471,6 @@ def _is_boolean(self):
471471
return is_bool_dtype(self.categories)
472472

473473

474-
class DatetimeTZDtypeType(type):
475-
"""
476-
the type of DatetimeTZDtype, this metaclass determines subclass ability
477-
"""
478-
pass
479-
480-
481474
class DatetimeTZDtype(PandasExtensionDtype):
482475

483476
"""
@@ -487,7 +480,7 @@ class DatetimeTZDtype(PandasExtensionDtype):
487480
THIS IS NOT A REAL NUMPY DTYPE, but essentially a sub-class of
488481
np.datetime64[ns]
489482
"""
490-
type = DatetimeTZDtypeType
483+
type = Timestamp
491484
kind = 'M'
492485
str = '|M8[ns]'
493486
num = 101

pandas/tests/dtypes/test_common.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -605,10 +605,10 @@ def test__get_dtype_fails(input_param):
605605
(pd.DatetimeIndex([1, 2]), np.datetime64),
606606
(pd.DatetimeIndex([1, 2]).dtype, np.datetime64),
607607
('<M8[ns]', np.datetime64),
608-
(pd.DatetimeIndex([1, 2], tz='Europe/London'), com.DatetimeTZDtypeType),
608+
(pd.DatetimeIndex([1, 2], tz='Europe/London'), pd.Timestmap),
609609
(pd.DatetimeIndex([1, 2], tz='Europe/London').dtype,
610-
com.DatetimeTZDtypeType),
611-
('datetime64[ns, Europe/London]', com.DatetimeTZDtypeType),
610+
pd.Timestmap),
611+
('datetime64[ns, Europe/London]', pd.Timestmap),
612612
(pd.SparseSeries([1, 2], dtype='int32'), np.int32),
613613
(pd.SparseSeries([1, 2], dtype='int32').dtype, np.int32),
614614
(PeriodDtype(freq='D'), pd.Period),

0 commit comments

Comments
 (0)