I found multible questions with similar titles but they didn't match with my case.
I have a np.array with offset values and I want the mean value for index from all previous values.
My first approach was with a for loop, but with huge arrays it is obviously way to slow.
offset = np.array([2, 4, 5, 7, 8, 10])
mean_mraw = []
for i, ofs in enumerate(offset):
mean_mraw.append(offset[0:i+1].mean())
So what I expect is this:
mean_mraw = [2, 3, 3.6, 4.5, 5.2, 6] #np.array
Is there np- build in function for that or how could I solve that in another way.
Thanks