get the mean of all not nan values code example Example: get the mean of all not nan values In [108]: np.nanmean([np.nan, 1, 2, np.nan, 3]) Out[108]: 2.0