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


Groups > comp.lang.python > #100244

Re: np.searchSorted over 2D array

From Oscar Benjamin <oscar.j.benjamin@gmail.com>
Newsgroups comp.lang.python
Subject Re: np.searchSorted over 2D array
Date 2015-12-10 19:55 +0000
Message-ID <mailman.120.1449777339.12405.python-list@python.org> (permalink)
References <2b660168-3322-4bf6-bd8b-2dc846a3a874@googlegroups.com> <mailman.95.1449679003.12405.python-list@python.org> <168a11ec-dd1e-481c-827b-8f5021a315cb@googlegroups.com>

Show all headers | View raw


On 10 Dec 2015 14:46, "Heli" <hemla21@gmail.com> wrote:
>
> Thanks Peter,
>
> I will try to explain what I really need.
>
> I have a 3D numpy array of 100*100*100 (1M elements). Then I have another
numpy array of for example 10*2*10 (200 elements). I want to know if in the
bigger dataset of 100*100*100, there is anywhere, where the second numpy
array of 200 elements with shape 10*2*10 appears. If it does, then I want
the indices of the bigger dataset where this happens.
>

So you want to find N in M. First find all occurrences of N[0][0][0] in
M[:90][:98][:90]. Then for each of those extract the same size subview from
M and check if (Ms == N).all().

--
Oscar

Back to comp.lang.python | Previous | NextPrevious 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