Skip to content

CLN: remove ABCSparseArray #33957

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pandas/core/arrays/sparse/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
is_string_dtype,
pandas_dtype,
)
from pandas.core.dtypes.generic import ABCIndexClass, ABCSeries, ABCSparseArray
from pandas.core.dtypes.generic import ABCIndexClass, ABCSeries
from pandas.core.dtypes.missing import isna, na_value_for_dtype, notna

import pandas.core.algorithms as algos
Expand All @@ -58,7 +58,7 @@
_sparray_doc_kwargs = dict(klass="SparseArray")


def _get_fill(arr: ABCSparseArray) -> np.ndarray:
def _get_fill(arr: "SparseArray") -> np.ndarray:
"""
Create a 0-dim ndarray containing the fill value

Expand All @@ -83,7 +83,7 @@ def _get_fill(arr: ABCSparseArray) -> np.ndarray:


def _sparse_array_op(
left: ABCSparseArray, right: ABCSparseArray, op: Callable, name: str
left: "SparseArray", right: "SparseArray", op: Callable, name: str
) -> Any:
"""
Perform a binary operation between two arrays.
Expand Down
1 change: 0 additions & 1 deletion pandas/core/dtypes/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ 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",))
ABCCategorical = create_pandas_abc_type("ABCCategorical", "_typ", ("categorical"))
ABCDatetimeArray = create_pandas_abc_type("ABCDatetimeArray", "_typ", ("datetimearray"))
ABCTimedeltaArray = create_pandas_abc_type(
Expand Down
10 changes: 2 additions & 8 deletions pandas/core/ops/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
import operator

from pandas.core.dtypes.generic import ABCDataFrame, ABCSeries, ABCSparseArray
from pandas.core.dtypes.generic import ABCDataFrame, ABCSeries

from pandas.core.ops.roperator import (
radd,
Expand Down Expand Up @@ -225,10 +225,4 @@ def _create_methods(cls, arith_method, comp_method, bool_method, special):

def _add_methods(cls, new_methods):
for name, method in new_methods.items():
# For most methods, if we find that the class already has a method
# of the same name, it is OK to over-write it. The exception is
# inplace methods (__iadd__, __isub__, ...) for SparseArray, which
# retain the np.ndarray versions.
force = not (issubclass(cls, ABCSparseArray) and name.startswith("__i"))
if force or name not in cls.__dict__:
setattr(cls, name, method)
setattr(cls, name, method)
2 changes: 1 addition & 1 deletion pandas/tests/dtypes/test_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_abc_types(self):
assert isinstance(pd.Int64Index([1, 2, 3]), gt.ABCIndexClass)
assert isinstance(pd.Series([1, 2, 3]), gt.ABCSeries)
assert isinstance(self.df, gt.ABCDataFrame)
assert isinstance(self.sparse_array, gt.ABCSparseArray)
assert isinstance(self.sparse_array, gt.ABCExtensionArray)
assert isinstance(self.categorical, gt.ABCCategorical)

assert isinstance(pd.DateOffset(), gt.ABCDateOffset)
Expand Down