Re: [Numpy-discussion] Finding values in an array

2014-11-28 Thread Benjamin Root
If we don't have an operation for this in numpy's setops module, it probably should be added. Ben Root On Nov 28, 2014 10:21 PM, "Jaime Fernández del Río" wrote: > On Fri, Nov 28, 2014 at 5:15 PM, Nathaniel Smith wrote: > >> On Fri, Nov 28, 2014 at 3:15 AM, Alexander Belopolsky >> wrote: >> >

Re: [Numpy-discussion] Finding values in an array

2014-11-28 Thread Jaime Fernández del Río
On Fri, Nov 28, 2014 at 5:15 PM, Nathaniel Smith wrote: > On Fri, Nov 28, 2014 at 3:15 AM, Alexander Belopolsky > wrote: > > I probably miss something very basic, but how given two arrays a and b, > can > > I find positions in a where elements of b are located? If a were > sorted, I > > could u

Re: [Numpy-discussion] Finding values in an array

2014-11-28 Thread Nathaniel Smith
On Fri, Nov 28, 2014 at 3:15 AM, Alexander Belopolsky wrote: > I probably miss something very basic, but how given two arrays a and b, can > I find positions in a where elements of b are located? If a were sorted, I > could use searchsorted, but I don't want to get valid positions for elements >

Re: [Numpy-discussion] Finding values in an array

2014-11-28 Thread Robert Kern
On Fri, Nov 28, 2014 at 8:40 AM, Julian Taylor < jtaylor.deb...@googlemail.com> wrote: > On 28.11.2014 09:37, Robert Kern wrote: > > On Fri, Nov 28, 2014 at 8:22 AM, Julian Taylor > > mailto:jtaylor.deb...@googlemail.com>> > > wrote: > >> > >> On 28.11.2014 04:15, Alexander Belopolsky wrote: > >>

Re: [Numpy-discussion] Finding values in an array

2014-11-28 Thread Julian Taylor
On 28.11.2014 09:37, Robert Kern wrote: > On Fri, Nov 28, 2014 at 8:22 AM, Julian Taylor > mailto:jtaylor.deb...@googlemail.com>> > wrote: >> >> On 28.11.2014 04:15, Alexander Belopolsky wrote: >> > I probably miss something very basic, but how given two arrays a and b, >> > can I find positions in

Re: [Numpy-discussion] Finding values in an array

2014-11-28 Thread Robert Kern
On Fri, Nov 28, 2014 at 8:22 AM, Julian Taylor < jtaylor.deb...@googlemail.com> wrote: > > On 28.11.2014 04:15, Alexander Belopolsky wrote: > > I probably miss something very basic, but how given two arrays a and b, > > can I find positions in a where elements of b are located? If a were > > sorte

Re: [Numpy-discussion] Finding values in an array

2014-11-28 Thread Julian Taylor
On 28.11.2014 04:15, Alexander Belopolsky wrote: > I probably miss something very basic, but how given two arrays a and b, > can I find positions in a where elements of b are located? If a were > sorted, I could use searchsorted, but I don't want to get valid > positions for elements that are not

Re: [Numpy-discussion] Finding values in an array

2014-11-27 Thread Stephan Hoyer
On Thu, Nov 27, 2014 at 10:15 PM, Alexander Belopolsky wrote: > I probably miss something very basic, but how given two arrays a and b, > can I find positions in a where elements of b are located? If a were > sorted, I could use searchsorted, but I don't want to get valid positions > for element

[Numpy-discussion] Finding values in an array

2014-11-27 Thread Alexander Belopolsky
I probably miss something very basic, but how given two arrays a and b, can I find positions in a where elements of b are located? If a were sorted, I could use searchsorted, but I don't want to get valid positions for elements that are not in a. In my case, a has unique elements, but in the gene