Consider dataframe as follows:
list1
0 2
1 5
2 4
3 8
4 4
5 7
6 8
i want to write a code in pandas, in which "sum" will be the sum of subsequent elements in two rows in "list1", output will be as follows:
list1 sum
0 2 NaN
1 5 7
2 4 9
3 8 12
4 4 12
5 7 11
6 8 15