I have two numpy arrays:
a = np.array([12, 13, 10])
b = np.array([[22, 123], [10, 142], [23, 232], [42, 122], [12, 239]])
I want to delete rows in b if the first element is not in a. Something like:
c = np.delete(b, np.where(a not in b[:, 0]))
print(c) gives:
[ 22 123 10 142 23 232 42 122 12 239]
which doesn't delete an element: c should look like
c = [[10, 142],
[12, 239]]
a not in b[:,0]produce? And after thenp.where? You need to understand, and know, what each step in the expression is doing. Also review whatnp.deleteexpects.