d[-np.isnan(d)] gives the values in d that are not NaN (i.e. all the *numbers*). The '<' operator gives False if either side has a NaN.