Skip to content

Commit 6f9aa6a

Browse files
h-vetinarivaibhavhrt
authored andcommitted
Clean up ufuncs post numpy bump (pandas-dev#26606)
1 parent ee52d0e commit 6f9aa6a

File tree

3 files changed

+0
-35
lines changed

3 files changed

+0
-35
lines changed

pandas/core/arrays/sparse.py

-9
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,6 @@ class SparseArray(PandasObject, ExtensionArray, ExtensionOpsMixin):
573573
Whether to explicitly copy the incoming `data` array.
574574
"""
575575

576-
__array_priority__ = 15
577576
_pandas_ftype = 'sparse'
578577
_subtyp = 'sparse_array' # register ABCSparseArray
579578

@@ -1639,14 +1638,6 @@ def T(self):
16391638
# Ufuncs
16401639
# ------------------------------------------------------------------------
16411640

1642-
def __array_wrap__(self, array, context=None):
1643-
from pandas.core.dtypes.generic import ABCSparseSeries
1644-
1645-
ufunc, inputs, _ = context
1646-
inputs = tuple(x.to_dense() if isinstance(x, ABCSparseSeries) else x
1647-
for x in inputs)
1648-
return self.__array_ufunc__(ufunc, '__call__', *inputs)
1649-
16501641
_HANDLED_TYPES = (np.ndarray, numbers.Number)
16511642

16521643
def __array_ufunc__(self, ufunc, method, *inputs, **kwargs):

pandas/core/sparse/frame.py

-6
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,6 @@ def _init_spmatrix(self, data, index, columns, dtype=None,
242242
def to_coo(self):
243243
return SparseFrameAccessor(self).to_coo()
244244

245-
def __array_wrap__(self, result):
246-
return self._constructor(
247-
result, index=self.index, columns=self.columns,
248-
default_kind=self._default_kind,
249-
default_fill_value=self._default_fill_value).__finalize__(self)
250-
251245
def __getstate__(self):
252246
# pickling
253247
return dict(_typ=self._typ, _subtyp=self._subtyp, _data=self._data,

pandas/core/sparse/series.py

-20
Original file line numberDiff line numberDiff line change
@@ -124,26 +124,6 @@ def __array_ufunc__(self, ufunc, method, *inputs, **kwargs):
124124
fill_value=result.fill_value,
125125
copy=False).__finalize__(self)
126126

127-
def __array_wrap__(self, result, context=None):
128-
"""
129-
Gets called prior to a ufunc (and after)
130-
131-
See SparseArray.__array_wrap__ for detail.
132-
"""
133-
result = self.values.__array_wrap__(result, context=context)
134-
return self._constructor(result, index=self.index,
135-
sparse_index=self.sp_index,
136-
fill_value=result.fill_value,
137-
copy=False).__finalize__(self)
138-
139-
def __array_finalize__(self, obj):
140-
"""
141-
Gets called after any ufunc or other array operations, necessary
142-
to pass on the index.
143-
"""
144-
self.name = getattr(obj, 'name', None)
145-
self.fill_value = getattr(obj, 'fill_value', None)
146-
147127
# unary ops
148128
# TODO: See if this can be shared
149129
def __pos__(self):

0 commit comments

Comments
 (0)