Skip to content

Commit faf581a

Browse files
committed
CLN: extension dtypes need to be refernced directly
1 parent bd1fde4 commit faf581a

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

pandas/core/common.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -907,9 +907,9 @@ def _get_dtype_from_object(dtype):
907907
if isinstance(dtype, type) and issubclass(dtype, np.generic):
908908
return dtype
909909
elif is_categorical(dtype):
910-
return CategoricalDtype().type
910+
return gt.CategoricalDtype().type
911911
elif is_datetimetz(dtype):
912-
return DatetimeTZDtype(dtype).type
912+
return gt.DatetimeTZDtype(dtype).type
913913
elif isinstance(dtype, np.dtype): # dtype object
914914
try:
915915
_validate_date_like_dtype(dtype)
@@ -1465,9 +1465,9 @@ def is_datetimelike(arr):
14651465
def _coerce_to_dtype(dtype):
14661466
""" coerce a string / np.dtype to a dtype """
14671467
if is_categorical_dtype(dtype):
1468-
dtype = CategoricalDtype()
1468+
dtype = gt.CategoricalDtype()
14691469
elif is_datetime64tz_dtype(dtype):
1470-
dtype = DatetimeTZDtype(dtype)
1470+
dtype = gt.DatetimeTZDtype(dtype)
14711471
else:
14721472
dtype = np.dtype(dtype)
14731473
return dtype
@@ -1478,15 +1478,15 @@ def _get_dtype(arr_or_dtype):
14781478
return arr_or_dtype
14791479
elif isinstance(arr_or_dtype, type):
14801480
return np.dtype(arr_or_dtype)
1481-
elif isinstance(arr_or_dtype, CategoricalDtype):
1481+
elif isinstance(arr_or_dtype, gt.CategoricalDtype):
14821482
return arr_or_dtype
1483-
elif isinstance(arr_or_dtype, DatetimeTZDtype):
1483+
elif isinstance(arr_or_dtype, gt.DatetimeTZDtype):
14841484
return arr_or_dtype
14851485
elif isinstance(arr_or_dtype, compat.string_types):
14861486
if is_categorical_dtype(arr_or_dtype):
1487-
return CategoricalDtype.construct_from_string(arr_or_dtype)
1487+
return gt.CategoricalDtype.construct_from_string(arr_or_dtype)
14881488
elif is_datetime64tz_dtype(arr_or_dtype):
1489-
return DatetimeTZDtype.construct_from_string(arr_or_dtype)
1489+
return gt.DatetimeTZDtype.construct_from_string(arr_or_dtype)
14901490

14911491
if hasattr(arr_or_dtype, 'dtype'):
14921492
arr_or_dtype = arr_or_dtype.dtype
@@ -1498,15 +1498,15 @@ def _get_dtype_type(arr_or_dtype):
14981498
return arr_or_dtype.type
14991499
elif isinstance(arr_or_dtype, type):
15001500
return np.dtype(arr_or_dtype).type
1501-
elif isinstance(arr_or_dtype, CategoricalDtype):
1502-
return CategoricalDtypeType
1503-
elif isinstance(arr_or_dtype, DatetimeTZDtype):
1504-
return DatetimeTZDtypeType
1501+
elif isinstance(arr_or_dtype, gt.CategoricalDtype):
1502+
return gt.CategoricalDtypeType
1503+
elif isinstance(arr_or_dtype, gt.DatetimeTZDtype):
1504+
return gt.DatetimeTZDtypeType
15051505
elif isinstance(arr_or_dtype, compat.string_types):
15061506
if is_categorical_dtype(arr_or_dtype):
1507-
return CategoricalDtypeType
1507+
return gt.CategoricalDtypeType
15081508
elif is_datetime64tz_dtype(arr_or_dtype):
1509-
return DatetimeTZDtypeType
1509+
return gt.DatetimeTZDtypeType
15101510
return _get_dtype_type(np.dtype(arr_or_dtype))
15111511
try:
15121512
return arr_or_dtype.dtype.type
@@ -1558,7 +1558,7 @@ def is_datetime64_dtype(arr_or_dtype):
15581558

15591559

15601560
def is_datetime64tz_dtype(arr_or_dtype):
1561-
return DatetimeTZDtype.is_dtype(arr_or_dtype)
1561+
return gt.DatetimeTZDtype.is_dtype(arr_or_dtype)
15621562

15631563

15641564
def is_datetime64_any_dtype(arr_or_dtype):
@@ -1719,7 +1719,7 @@ def is_categorical(array):
17191719

17201720

17211721
def is_categorical_dtype(arr_or_dtype):
1722-
return CategoricalDtype.is_dtype(arr_or_dtype)
1722+
return gt.CategoricalDtype.is_dtype(arr_or_dtype)
17231723

17241724

17251725
def is_complex_dtype(arr_or_dtype):

0 commit comments

Comments
 (0)