Skip to content

Commit 813d76e

Browse files
author
Santhosh Kumar Bethi
committed
added condition to avoid max recursion depth
1 parent 066a4f7 commit 813d76e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pandas/core/arrays/sparse/array.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,6 +1571,9 @@ def cumsum(self, axis: AxisInt = 0, *args, **kwargs) -> SparseArray:
15711571
raise ValueError(f"axis(={axis}) out of bounds")
15721572

15731573
if not self._null_fill_value:
1574+
if isinstance(self, SparseArray) and self.fill_value == 0:
1575+
# special case where we can avoid densifying
1576+
return SparseArray(self.to_dense().cumsum())
15741577
return SparseArray(self.to_dense()).cumsum()
15751578

15761579
return SparseArray(

0 commit comments

Comments
 (0)