Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #100200

np.searchSorted over 2D array

Newsgroups comp.lang.python
Date 2015-12-09 08:06 -0800
Message-ID <2b660168-3322-4bf6-bd8b-2dc846a3a874@googlegroups.com> (permalink)
Subject np.searchSorted over 2D array
From Heli <hemla21@gmail.com>

Show all headers | View raw


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, 

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

np.searchSorted over 2D array Heli <hemla21@gmail.com> - 2015-12-09 08:06 -0800
  Re: np.searchSorted over 2D array Peter Otten <__peter__@web.de> - 2015-12-09 17:36 +0100
    Re: np.searchSorted over 2D array Heli <hemla21@gmail.com> - 2015-12-10 06:40 -0800
      Re: np.searchSorted over 2D array Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2015-12-10 19:55 +0000

csiph-web