I want to create an array or list which only contains 3 entries at any given time. The function should loop and with each loop 1 entry will be added to the list pushing the oldest value out and then a value will be calculated based on the 3 values in the list.
I have tried:
import numpy as np
z = np.ndarray((3,),float)
np.append(z, [12, 14.56, 12.46, 1.56])
which creates a numpy array with only 3 values (afaik) however the array is populated with strange values:
z= ([ 1.56889217e-163, 1.01899555e-297, 1.03395110e-297])
anyone know why/what I'm doing wrong or have a better solution for what I want to do?