numpy is nan? code example Example 1: check nan values in a np array array_has_nan = np.isnan(array_sum) Example 2: numpy is not nan a = a[~np.isnan(a)]