@@ -2030,13 +2030,19 @@ def test_non_cython_api(self):
20302030 assert_frame_equal (result ,expected )
20312031
20322032 # cumsum (GH5614)
2033- df = DataFrame ([[1 , 2 , np .nan ], [1 , np .nan , 9 ], [3 , 4 , 9 ]], columns = ['A' , 'B' , 'C' ])
2034- expected = DataFrame ([[2 , np .nan ], [np .nan , 9 ], [4 , 9 ]], columns = ['B' , 'C' ])
2035- result = df .groupby ('A' ).cumsum ()
2033+ df = DataFrame ([[1 , 2 , np .nan ], [1 , np .nan , 9 ], [1 , 1 , 2 ], [3 , 4 , 9 ]], columns = ['A' , 'B' , 'C' ])
2034+ import pdb ; pdb .set_trace ()
2035+ expected = DataFrame ([[2 , np .nan ], [np .nan ,9 ], [3 , 11 ], [4 , 9 ]],
2036+ columns = ['B' , 'C' ],
2037+ index = MultiIndex .from_tuples ([(1 ,0 ),(1 ,1 ),(1 ,2 ),(3 ,0 )],names = ['A' ,None ]))
2038+ g = df .groupby ('A' )
2039+ result = g .cumsum ()
20362040 assert_frame_equal (result ,expected )
20372041
2038- expected = DataFrame ([[1 , 2 , np .nan ], [2 , np .nan , 9 ], [3 , 4 , 9 ]], columns = ['A' , 'B' , 'C' ]).astype ('float64' )
2039- result = df .groupby ('A' , as_index = False ).cumsum ()
2042+ expected = DataFrame ([[1 , 2 , np .nan ], [2 , np .nan , 9 ], [3 , 3 , 11 ], [3 , 4 , 9 ]],
2043+ columns = ['A' , 'B' , 'C' ])
2044+ g = df .groupby ('A' , as_index = False )
2045+ result = g .cumsum ()
20402046 assert_frame_equal (result ,expected )
20412047
20422048 def test_grouping_ndarray (self ):
0 commit comments