Average of a numpy array returns NaN

Viewed 19425

I have an np.array with over 330,000 rows. I simply try to take the average of it and it returns NaN. Even if I try to filter out any potential NaN values in my array (there shouldn't be any anyways), average returns NaN. Am I doing something totally wacky?

My code is here:

average(ngma_heat_daily)
Out[70]: nan

average(ngma_heat_daily[ngma_heat_daily != nan])
Out[71]: nan
2 Answers

Also, there is a function named nanmedian which ignores NaN values. Signature of that function is: numpy.nanmedian(a, axis=None, out=None, overwrite_input=False, keepdims=<no value>)

Related