From bd9805e97644a6863b5b0c78ada6685b77024cf1 Mon Sep 17 00:00:00 2001 From: jschendel Date: Sat, 6 Jan 2018 20:47:18 -0700 Subject: [PATCH] remove code for unsupported dtypes and remove 'interval[]' --- doc/source/whatsnew/v0.23.0.txt | 2 +- pandas/core/dtypes/dtypes.py | 17 ++++------------- pandas/tests/dtypes/test_dtypes.py | 21 ++++++--------------- 3 files changed, 11 insertions(+), 29 deletions(-) diff --git a/doc/source/whatsnew/v0.23.0.txt b/doc/source/whatsnew/v0.23.0.txt index 65e0062fea0cb..783de6569a542 100644 --- a/doc/source/whatsnew/v0.23.0.txt +++ b/doc/source/whatsnew/v0.23.0.txt @@ -378,7 +378,7 @@ Conversion - Fixed bug where comparing :class:`DatetimeIndex` failed to raise ``TypeError`` when attempting to compare timezone-aware and timezone-naive datetimelike objects (:issue:`18162`) - Bug in :class:`DatetimeIndex` where the repr was not showing high-precision time values at the end of a day (e.g., 23:59:59.999999999) (:issue:`19030`) - Bug where dividing a scalar timedelta-like object with :class:`TimedeltaIndex` performed the reciprocal operation (:issue:`19125`) -- Bug in ``IntervalDtype`` when constructing two instances with subtype ``CategoricalDtype`` where the second instance used cached attributes from the first (:issue:`18980`) +- Indexing ^^^^^^^^ diff --git a/pandas/core/dtypes/dtypes.py b/pandas/core/dtypes/dtypes.py index fce371bec363d..2ec35889d6a7a 100644 --- a/pandas/core/dtypes/dtypes.py +++ b/pandas/core/dtypes/dtypes.py @@ -654,7 +654,7 @@ def __new__(cls, subtype=None): u.subtype = None return u elif (isinstance(subtype, compat.string_types) and - subtype in ('interval', 'interval[]')): + subtype.lower() == 'interval'): subtype = None else: if isinstance(subtype, compat.string_types): @@ -667,11 +667,6 @@ def __new__(cls, subtype=None): except TypeError: raise ValueError("could not construct IntervalDtype") - if subtype is None: - u = object.__new__(cls) - u.subtype = None - return u - if is_categorical_dtype(subtype) or is_string_dtype(subtype): # GH 19016 msg = ('category, object, and string subtypes are not supported ' @@ -679,15 +674,11 @@ def __new__(cls, subtype=None): raise TypeError(msg) try: - # GH 18980: need to combine since str and hash individually may not - # be unique, e.g. str(CategoricalDtype) always returns 'category', - # and hash(np.dtype('