Given a numpy array
a = np.array([[0, -1, 0], [1, 0, 0], [1, 0, -1]])
what\'s the fastest way to delete all elements of value -1
-1
How about this?
print([[y for y in x if y > -1] for x in a]) [[0, 0], [1, 0, 0], [1, 0]]