Re: [Numpy-discussion] Lookup array

2011-10-11 Thread Andrey N. Sobolev
В Mon, 10 Oct 2011 11:20:08 -0400 Olivier Delalleau пишет: > > The following doesn't use numpy but seems to be about 20x faster: > > A_rows = {} > for i, row in enumerate(A): > A_rows[tuple(row)] = i > for i, row in enumerate(B): > C[i] = A_rows.get(tuple(row), -1) >

Re: [Numpy-discussion] Lookup array

2011-10-10 Thread Olivier Delalleau
2011/10/10 Andrey N. Sobolev > В Mon, 10 Oct 2011 10:03:48 +0100 > Bob Dowling пишет: > > > > > On 10/10/11 09:53, Andrey N. Sobolev wrote: > > > > > I have 2 arrays - A with the dimensions of 1000x4 and B with the > > > dimensions of 5000x4. B doesn't (hopefully) contain any rows that > > > are

Re: [Numpy-discussion] Lookup array

2011-10-10 Thread Andrey N. Sobolev
В Mon, 10 Oct 2011 10:03:48 +0100 Bob Dowling пишет: > > On 10/10/11 09:53, Andrey N. Sobolev wrote: > > > I have 2 arrays - A with the dimensions of 1000x4 and B with the > > dimensions of 5000x4. B doesn't (hopefully) contain any rows that > > are not in A. I need to create a lookup array C,

Re: [Numpy-discussion] Lookup array

2011-10-10 Thread Bob Dowling
On 10/10/11 09:53, Andrey N. Sobolev wrote: > I have 2 arrays - A with the dimensions of 1000x4 and B with the > dimensions of 5000x4. B doesn't (hopefully) contain any rows that are > not in A. I need to create a lookup array C, the i-th value of which > will be the index of B[i] in A. In the (v

[Numpy-discussion] Lookup array

2011-10-10 Thread Andrey N. Sobolev
Hi all, I have 2 arrays - A with the dimensions of 1000x4 and B with the dimensions of 5000x4. B doesn't (hopefully) contain any rows that are not in A. I need to create a lookup array C, the i-th value of which will be the index of B[i] in A. In the (very rare) case when B[i] is not in A C[i] sho