diff --git a/text_extensions_for_pandas/array/span.py b/text_extensions_for_pandas/array/span.py index 372d5826..46ce86ad 100644 --- a/text_extensions_for_pandas/array/span.py +++ b/text_extensions_for_pandas/array/span.py @@ -32,12 +32,11 @@ from pandas.api.types import is_bool_dtype from pandas.core.dtypes.generic import ABCDataFrame, ABCSeries try: - from pandas.core.dtypes.generic import ABCIndexClass + from pandas.core.dtypes.generic import ABCIndex except ImportError: # ABCIndexClass changed to ABCIndex in Pandas 1.3 # noinspection PyUnresolvedReferences - from pandas.core.dtypes.generic import ABCIndex - ABCIndexClass = ABCIndex + from pandas.core.dtypes.generic import ABCIndexClass as ABCIndex from pandas.core.indexers import check_array_indexer # Internal imports @@ -82,7 +81,7 @@ def __add__(self, other) -> Union["Span", "SpanArray"]: :param other: Span or SpanArray :return: minimal span (or array of spans) that covers both inputs. """ - if isinstance(other, (ABCDataFrame, ABCSeries, ABCIndexClass)): + if isinstance(other, (ABCDataFrame, ABCSeries, ABCIndex)): # Rely on pandas to unbox and dispatch to us. return NotImplemented @@ -523,7 +522,7 @@ def __eq__(self, other): :return: Returns a boolean mask indicating which rows match `other`. """ - if isinstance(other, (ABCDataFrame, ABCSeries, ABCIndexClass)): + if isinstance(other, (ABCDataFrame, ABCSeries, ABCIndex)): # Rely on pandas to unbox and dispatch to us. return NotImplemented if isinstance(other, Span): @@ -550,7 +549,7 @@ def __eq__(self, other): "'{}' and '{}'".format(type(self), type(other))) def __ne__(self, other): - if isinstance(other, (ABCDataFrame, ABCSeries, ABCIndexClass)): + if isinstance(other, (ABCDataFrame, ABCSeries, ABCIndex)): # Rely on pandas to unbox and dispatch to us. return NotImplemented return ~(self == other) @@ -760,7 +759,7 @@ def __lt__(self, other): `other`. span1 < span2 if span1.end <= span2.begin and both spans are over the same target text. """ - if isinstance(other, (ABCDataFrame, ABCSeries, ABCIndexClass)): + if isinstance(other, (ABCDataFrame, ABCSeries, ABCIndex)): # Rely on pandas to unbox and dispatch to us. return NotImplemented elif not isinstance(other, (Span, SpanArray)): @@ -772,7 +771,7 @@ def __lt__(self, other): return np.logical_and(offsets_mask, text_mask) def __gt__(self, other): - if isinstance(other, (ABCDataFrame, ABCSeries, ABCIndexClass)): + if isinstance(other, (ABCDataFrame, ABCSeries, ABCIndex)): # Rely on pandas to unbox and dispatch to us. return NotImplemented if isinstance(other, (SpanArray, Span)): diff --git a/text_extensions_for_pandas/array/tensor.py b/text_extensions_for_pandas/array/tensor.py index 474e212b..0f15342f 100644 --- a/text_extensions_for_pandas/array/tensor.py +++ b/text_extensions_for_pandas/array/tensor.py @@ -31,12 +31,11 @@ from pandas.compat import set_function_name from pandas.core.dtypes.generic import ABCDataFrame, ABCSeries try: - from pandas.core.dtypes.generic import ABCIndexClass + from pandas.core.dtypes.generic import ABCIndex except ImportError: # ABCIndexClass changed to ABCIndex in Pandas 1.3 # noinspection PyUnresolvedReferences - from pandas.core.dtypes.generic import ABCIndex - ABCIndexClass = ABCIndex + from pandas.core.dtypes.generic import ABCIndexClass as ABCIndex from pandas.core.indexers import check_array_indexer, validate_indices """ Begin Patching of ExtensionArrayFormatter """ @@ -219,7 +218,7 @@ def _create_method(cls, op, coerce_to_dtype=True, result_dtype=None): def _binop(self, other): lvalues = self._tensor - if isinstance(other, (ABCDataFrame, ABCSeries, ABCIndexClass)): + if isinstance(other, (ABCDataFrame, ABCSeries, ABCIndex)): # Rely on pandas to unbox and dispatch to us. return NotImplemented diff --git a/text_extensions_for_pandas/array/token_span.py b/text_extensions_for_pandas/array/token_span.py index 6d265b63..062624ca 100644 --- a/text_extensions_for_pandas/array/token_span.py +++ b/text_extensions_for_pandas/array/token_span.py @@ -31,12 +31,11 @@ from pandas.api.types import is_bool_dtype from pandas.core.dtypes.generic import ABCDataFrame, ABCSeries try: - from pandas.core.dtypes.generic import ABCIndexClass + from pandas.core.dtypes.generic import ABCIndex except ImportError: # ABCIndexClass changed to ABCIndex in Pandas 1.3 # noinspection PyUnresolvedReferences - from pandas.core.dtypes.generic import ABCIndex - ABCIndexClass = ABCIndex + from pandas.core.dtypes.generic import ABCIndexClass as ABCIndex from pandas.core.indexers import check_array_indexer @@ -504,7 +503,7 @@ def __eq__(self, other): :return: Returns a boolean mask indicating which rows match `other`. """ - if isinstance(other, (ABCDataFrame, ABCSeries, ABCIndexClass)): + if isinstance(other, (ABCDataFrame, ABCSeries, ABCIndex)): # Rely on pandas to unbox and dispatch to us. return NotImplemented elif (isinstance(other, TokenSpanArray) and len(self) == len(other)