Вы можете использовать np.where()
для индексации:
a = np.random.randint(0, 2, size=(10,10))
# array([[1, 1, 0, 0, 0, 0, 0, 1, 1, 1],
# [1, 0, 0, 0, 1, 1, 1, 1, 0, 1],
# [1, 0, 1, 0, 0, 1, 0, 0, 0, 1],
# [1, 0, 0, 1, 0, 1, 0, 1, 1, 0],
# [1, 0, 0, 0, 1, 0, 1, 1, 0, 1],
# [0, 0, 1, 1, 1, 0, 1, 0, 0, 0],
# [1, 0, 0, 1, 1, 0, 0, 1, 1, 0],
# [0, 0, 0, 1, 0, 1, 0, 1, 1, 1],
# [0, 0, 1, 1, 0, 0, 1, 0, 1, 0],
# [1, 1, 0, 0, 0, 1, 0, 0, 1, 1]])
np.where(np.count_nonzero(a, axis=1)<5) # In your case, should be > 1
# (array([2, 5, 8]),)
a[np.where(np.count_nonzero(a, axis=1)<5)] # Returns the array you wanted
# array([[1, 0, 1, 0, 0, 1, 0, 0, 0, 1],
# [0, 0, 1, 1, 1, 0, 1, 0, 0, 0],
# [0, 0, 1, 1, 0, 0, 1, 0, 1, 0]])