I have a data frame like this
amount
0 351
1 684
2 931
3 186
4 412
5 674
I want to add a new column called like 3 days average which contains values equal to the average of the amount of current row and 2 rows above it. For example the 3davg of row 2 = (931+684+351)/3, row 3 = (186+931+684)/3. Final result should be looking like this
amount 3davg
0 351 DNE
1 684 DNE
2 931 655
3 186 600
4 412 509
5 674 424
I have to achieve it in a big data frame and will be having flexible ~davgs, how would I do it in pandas?