How to calculate a moving average or moving average, where I consider all the elements that I have seen so far.
Say I have a data frame as shown below
col new_col
0 1 1
1 2 1.5
2 3 2
etc. Now I would like to add a new column, where I drop the average of all the elements in the column to this point. Setting the window will mean that I will get the first few, like Nan, and then it will only be a pivot window. But I need something like the above.
source
share