I spent several hours trying to make a “cumulative total group” on the pandas framework. I looked through all the answers on stackoverflow and, surprisingly, none of them can solve my (very elementary) problem:
I have a dataframe:
df1
Out[8]:
Name Date Amount
0 Jack 2016-01-31 10
1 Jack 2016-02-29 5
2 Jack 2016-02-29 8
3 Jill 2016-01-31 10
4 Jill 2016-02-29 5
I'm trying to
- by ['Name', 'Date'] and
- cumsum 'Amount'.
- That's all.
Thus, the desired result:
df1
Out[10]:
Name Date Cumsum
0 Jack 2016-01-31 10
1 Jack 2016-02-29 23
2 Jill 2016-01-31 10
3 Jill 2016-02-29 15
EDIT: . "" cumsum. , "10, 23, 10, 15". . NB: , , .
/ .