I have a stock data analysis spreadsheet in Excel which need to be converted to Python. I have one column where I calculate the 10d rolling average of the preceding dates. When I define a new column and use the rolling mean function I get NaN for the first rows, which is not desired given that the top rows are the last days of the dataset. The NaN values should be in the footer of the dataset. However, I can not find documentation or a solution on how to "invert" the rolling mean.
I have tried to mention all column + row names and divide them by 10. Ugly, but it works. Next step is the 50d moving average and I don't want to clutter up my code fields.
esdata["10d rolling"] = esdata["RoC ABS"].rolling(10).mean()
This does not give the desired outcome due to the NaN for the latest days. Column A has ["Date"] in descending order and is updated every day.
In Excel I use the =AVERAGE(A2:A53) function.
How can I replicate this in Python?