0

Sorry for my broken English, I know the title is weird. But I want to do is like below.
Let' s say I have a Series

pd.Series([1,3,2,1,4,3])

0    1
1    3
2    2
3    1
4    4
5    3
dtype: int64

I want to add each record with the former 2 records and get the Series below.
For instance, for 5th record, the new value 8 = 1 + 4 + 3.

0    1
1    4
2    6
3    6
4    7
5    8
dtype: int64
Dawei
  • 1,046
  • 12
  • 21

0 Answers0