Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAugspurger committed Oct 2, 2018
1 parent f07ab80 commit 83db05c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 15 deletions.
4 changes: 3 additions & 1 deletion pandas/core/dtypes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ def type(self):
"""The scalar type for the array, e.g. ``int``
It's expected ``ExtensionArray[item]`` returns an instance
of ``ExtensionDtype.type`` for scalar ``item``.
of ``ExtensionDtype.type`` for scalar ``item``, assuming
that value is valid (not NA). NA values do not need to be
instances of `type`.
"""
raise AbstractMethodError(self)

Expand Down
4 changes: 2 additions & 2 deletions pandas/core/dtypes/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from pandas.compat import (string_types, text_type, binary_type,
PY3, PY36)
from pandas._libs import algos, lib
from pandas._libs.tslibs import conversion, Period
from pandas._libs.tslibs import conversion, Period, Timestamp
from pandas._libs.interval import Interval

from pandas.core.dtypes.dtypes import (
Expand Down Expand Up @@ -1915,7 +1915,7 @@ def _get_dtype_type(arr_or_dtype):
if is_categorical_dtype(arr_or_dtype):
return CategoricalDtypeType
elif is_datetime64tz_dtype(arr_or_dtype):
return DatetimeTZDtypeType
return Timestmap
elif is_period_dtype(arr_or_dtype):
return Period
elif is_interval_dtype(arr_or_dtype):
Expand Down
11 changes: 2 additions & 9 deletions pandas/core/dtypes/dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import numpy as np
from pandas import compat
from pandas.core.dtypes.generic import ABCIndexClass, ABCCategoricalIndex
from pandas._libs.tslibs import Period, NaT
from pandas._libs.tslibs import Period, NaT, Timestamp
from pandas._libs.interval import Interval

from .base import ExtensionDtype, _DtypeOpsMixin
Expand Down Expand Up @@ -471,13 +471,6 @@ def _is_boolean(self):
return is_bool_dtype(self.categories)


class DatetimeTZDtypeType(type):
"""
the type of DatetimeTZDtype, this metaclass determines subclass ability
"""
pass


class DatetimeTZDtype(PandasExtensionDtype):

"""
Expand All @@ -487,7 +480,7 @@ class DatetimeTZDtype(PandasExtensionDtype):
THIS IS NOT A REAL NUMPY DTYPE, but essentially a sub-class of
np.datetime64[ns]
"""
type = DatetimeTZDtypeType
type = Timestamp
kind = 'M'
str = '|M8[ns]'
num = 101
Expand Down
6 changes: 3 additions & 3 deletions pandas/tests/dtypes/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,10 +605,10 @@ def test__get_dtype_fails(input_param):
(pd.DatetimeIndex([1, 2]), np.datetime64),
(pd.DatetimeIndex([1, 2]).dtype, np.datetime64),
('<M8[ns]', np.datetime64),
(pd.DatetimeIndex([1, 2], tz='Europe/London'), com.DatetimeTZDtypeType),
(pd.DatetimeIndex([1, 2], tz='Europe/London'), pd.Timestmap),
(pd.DatetimeIndex([1, 2], tz='Europe/London').dtype,
com.DatetimeTZDtypeType),
('datetime64[ns, Europe/London]', com.DatetimeTZDtypeType),
pd.Timestmap),
('datetime64[ns, Europe/London]', pd.Timestmap),
(pd.SparseSeries([1, 2], dtype='int32'), np.int32),
(pd.SparseSeries([1, 2], dtype='int32').dtype, np.int32),
(PeriodDtype(freq='D'), pd.Period),
Expand Down

0 comments on commit 83db05c

Please sign in to comment.