I have a dataframe, df, that I would like to calculate the moving average for the next 2 days, with a window of 5. I then wish to store the results in a variable within Python:
date count
08052020 50
08152020 10
08252020 30
09052020 10
09152020 15
09252020 5
This is what I am doing:
count = df['new'] = df['count'].rolling(2).mean()
print(count)
Any insight is appreciated.
Updated Desired output:
count = [23, 14]