removing pairs of elements from numpy arrays that are nan (or another value) in python,a[~(a == 5).any(1)]