@@ -2030,13 +2030,19 @@ def test_non_cython_api(self):
2030
2030
assert_frame_equal (result ,expected )
2031
2031
2032
2032
# 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 ()
2036
2040
assert_frame_equal (result ,expected )
2037
2041
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 ()
2040
2046
assert_frame_equal (result ,expected )
2041
2047
2042
2048
def test_grouping_ndarray (self ):
0 commit comments