File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
pandas/tests/arrays/sparse Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -363,6 +363,20 @@ def test_setting_fill_value_fillna_still_works():
363363 tm .assert_numpy_array_equal (result , expected )
364364
365365
366+ def test_cumsum_integer_no_recursion ():
367+ # GH 62669: RecursionError in integer SparseArray.cumsum
368+ arr = SparseArray ([1 , 2 , 3 ])
369+ result = arr .cumsum ()
370+ expected = SparseArray ([1 , 3 , 6 ])
371+ tm .assert_sp_array_equal (result , expected )
372+
373+ # Also test with some zeros interleaved
374+ arr2 = SparseArray ([0 , 1 , 0 , 2 ])
375+ result2 = arr2 .cumsum ()
376+ expected2 = SparseArray ([0 , 1 , 1 , 3 ])
377+ tm .assert_sp_array_equal (result2 , expected2 )
378+
379+
366380def test_setting_fill_value_updates ():
367381 arr = SparseArray ([0.0 , np .nan ], fill_value = 0 )
368382 arr .fill_value = np .nan
You can’t perform that action at this time.
0 commit comments