So I am trying to find a way to calculate a rolling average for n periods in a Numpy Array. I currently have this code where I would like to create a rolling average of lets say 10 periods.
import yfinance as yf
import numpy as np
TROW = yf.Ticker("TROW")
price = TROW.history(start='2010-01-01',end='2020-01-01')
arr = np.array(price)`
arr = arr[:, 3]
I would like to add a column in arr
and create the rolling average in the same array. What would be the best way to do this?