np.searchSorted over 2D array

Heli hemla21 at gmail.com
Wed Dec 9 11:06:59 EST 2015


Dear all, 

I need to check whether two 2d numpy arrays have intersections and if so I will need to have the cell indices of the intersection.

By intersection, I exactly mean the intersection definition used in set theory.

I will give an example of what I need to do:

a=[[0,1,2],[3,4,5],[6,7,8]]
b=[[0,1,2],[3,4,5]]

I would like to check whether b is subset of a and then get the indices in a where b matches. 

cellindices=[[True,True,True],[True,True,True],[False,False,False]]

What is the best way to do this in numpy? 

 
Thanks in Advance for your help, 




More information about the Python-list mailing list