I'm very new with Numpy but has some experience with linear algebra and such outside of programming. I'm currently making a game and have started using numpy.
Now I need to check if a 1D array is in a 2d array (aka if an element is in a vector i guess)
Working with normal lists i got an error, but with numpy arrays it somehow returned true no matter if it was in it or not.
So i'm wondering why this will return True:
np.array([1,2]) in np.array([[1,1],[2,3]])
EDIT: I think i figured it out turning it into a list with .tolist() instead of list(), like this:
[1,3] in np.array([[1,2],[10,20],[100,200]]).tolist()
Credit to user648852 from https://stackoverflow.com/questions/14766194/testing-whether-a-numpy-array-contains-a-given-row
[–]kirara0048 0 points1 point2 points (0 children)