I'm dealing with the HAR-RV model, trying to run this equation but having no success at all to store my operations on the array Here what I'm trying to calculate: r_[t,i] = Y_[t,i] - Y_[t,i-1] https://cdn1.imggmi.com/uploads/2019/8/30/299a4ab026de7db33c4222b30f3ed70a-full.png Im using the first relation here, where r means return and Y the stock prices t = 10 # daily intervals i = 30 # number of days s = 1 # (Here I've just created some fake numbers, intending to simulate some stock prices) Y = abs(np.random.random((10,30)) + 1) # initializing my return array return = np.array([]) # (I also tried to initialize it as a Matrix before..) : return = np.zeros((10,30)) # here is my for loop to store each daily return at its position on the "return" Array. I wanted an Array but got just "() size" for t in range(0,9): for i in range(1,29): return = np.array( Y.item((t,i)) - Y.item((t,i-1)) ) ... so, I was expecting something like this: return = [first difference, second difference, third difference...] how can I do that ? Continue reading...