Skip to content

Commit bfeb945

Browse files
Update pandas/core/arrays/sparse/array.py
Co-authored-by: Richard Shadrach <45562402+rhshadrach@users.noreply.github.com>
1 parent bc75673 commit bfeb945

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

pandas/core/arrays/sparse/array.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,10 +1570,7 @@ def cumsum(self, axis: AxisInt = 0, *args, **kwargs) -> SparseArray:
15701570
if axis is not None and axis >= self.ndim: # Mimic ndarray behaviour.
15711571
raise ValueError(f"axis(={axis}) out of bounds")
15721572

1573-
if not self._null_fill_value:
1574-
if isinstance(self, SparseArray) and self.fill_value == 0:
1575-
# special case where we can avoid max recursion depth
1576-
return SparseArray(self.to_dense().cumsum())
1573+
if not self._null_fill_value and self.fill_value != 0:
15771574
return SparseArray(self.to_dense()).cumsum()
15781575

15791576
return SparseArray(

0 commit comments

Comments
 (0)