python - Elementwise logical comparison of numpy arrays -
i have 2 numpy arrays of same shape. elements in arrays random integers [0,n]. need check (if any) of elements in same position in arrays equal.
the output need positions of same elements.
mock code:
a=np.array([0,1]) b=np.array([1,0]) c=np.array([1,1]) np.any_elemenwise(a,b) np.any_elemenwise(a,c) np.any_elemenwise(a,a)
desired output:
[] [1] [0,1]
i can write loop going through of elements 1 one, assume desired output can achieved faster.
edit:the question changed.
you want evaluate np.where(v1==v2)[0]
Comments
Post a Comment