I want to calculate means and averages in a data set, but for many reasons that I can't go into here, my array contains my values and some "filler" values (which are currently set to -1000).
How can I calculate the mean (for example) on only the non -1000 values?
res=[-1000 for x in range(0,10)]
res[1]=2
res[5]=3
res[7]=4
#something like this?
np.mean(res>-1000)
#the result should be the mean value of 2,3 and 4 (3)
MVCE
res=[1.0, 1.0, 1.0, 1.0, 1.0, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000]
#for instance
print(np.mean(res[res > -1000]))