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

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -