0

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?

Awitz
  • 296
  • 1
  • 11
  • Does this answer your question? [How to calculate moving average using NumPy?](https://stackoverflow.com/questions/14313510/how-to-calculate-moving-average-using-numpy) – Alex May 26 '20 at 03:22
  • Does this help? https://stackoverflow.com/questions/14313510/how-to-calculate-moving-average-using-numpy – Alex May 26 '20 at 03:23

0 Answers0