From 216370cd220e846be7dc6532dfec7f2dc6095004 Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Fri, 24 Jan 2020 18:36:19 -0800 Subject: [PATCH] CLN: remove _set_subtyp --- pandas/core/dtypes/generic.py | 4 +--- pandas/core/series.py | 10 +--------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/pandas/core/dtypes/generic.py b/pandas/core/dtypes/generic.py index 4c3f8b7374465..435d80b2c4dfb 100644 --- a/pandas/core/dtypes/generic.py +++ b/pandas/core/dtypes/generic.py @@ -56,9 +56,7 @@ def _check(cls, inst) -> bool: ABCSeries = create_pandas_abc_type("ABCSeries", "_typ", ("series",)) ABCDataFrame = create_pandas_abc_type("ABCDataFrame", "_typ", ("dataframe",)) -ABCSparseArray = create_pandas_abc_type( - "ABCSparseArray", "_subtyp", ("sparse_array", "sparse_series") -) +ABCSparseArray = create_pandas_abc_type("ABCSparseArray", "_subtyp", ("sparse_array",)) ABCCategorical = create_pandas_abc_type("ABCCategorical", "_typ", ("categorical")) ABCDatetimeArray = create_pandas_abc_type("ABCDatetimeArray", "_typ", ("datetimearray")) ABCTimedeltaArray = create_pandas_abc_type( diff --git a/pandas/core/series.py b/pandas/core/series.py index de34b2b047851..e79404ccd9521 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -392,7 +392,7 @@ def _can_hold_na(self): _index = None - def _set_axis(self, axis, labels, fastpath=False) -> None: + def _set_axis(self, axis, labels, fastpath: bool = False) -> None: """ Override generic, we want to set the _typ here. """ @@ -413,18 +413,10 @@ def _set_axis(self, axis, labels, fastpath=False) -> None: # or not be a DatetimeIndex pass - self._set_subtyp(is_all_dates) - object.__setattr__(self, "_index", labels) if not fastpath: self._data.set_axis(axis, labels) - def _set_subtyp(self, is_all_dates): - if is_all_dates: - object.__setattr__(self, "_subtyp", "time_series") - else: - object.__setattr__(self, "_subtyp", "series") - def _update_inplace(self, result, **kwargs): # we want to call the generic version and not the IndexOpsMixin return generic.NDFrame._update_inplace(self, result, **kwargs)