python - Get original values from cumulative sum -
>>> test.val.cumsum() 0 11 1 13 2 56 3 60 4 65 name: val, dtype: int64
how original values cumulative sum? have [11,2,43,4,5]
you use diff()
series method (with fillna
replace first value in series):
>>> s = pd.series([11, 13, 56, 60, 65]) >>> s.diff().fillna(s) 0 11 1 2 2 43 3 4 4 5 dtype: float64
Comments
Post a Comment