removing pairs of elements from numpy arrays that are NaN (or another value) in Python,np.isnan(a)