I have continous stream of data coming in from raspberry pi and I am appending them in a list. I am predicting the output in realtime, the thing now is Memory Management, I am afraid if keep the device running continously it will fill the list and eventually I may run out of memory. Is there any way I can append the value predict them and keep removing all the values from the list that are 100th prediction (index) above my current prediction(index).
i2c = board.I2C()
mpu = adafruit_mpu6050.MPU6050(i2c)
mpu_accelerometer_range = adafruit_mpu6050.Range.RANGE_4_G
data1 = []
j = 0
data2 = []
while(True):
j+=1
ax,ay,az = mpu.acceleration
magnitude = np.sqrt(np.square(ax)+np.square(ay)+np.square(az))
data1.append([magnitude])
df = pd.DataFrame(data1)