Reputation: 47
The elementary functions in numpy, like mean() and std() returns np.nan when encounter np.nan. Can I make them ignore it?
Upvotes: 0
Views: 1841
Reputation: 5355
The "normal" functions like np.mean
and np.std
evalutates the NaN i.e the result you've provided evaluates to NaN.
If you want to avoid that, use np.nanmean
and np.nanstd
. Note that since you have only one non-nan element the std is 0, thus you are dividing by zero.
Upvotes: 2