Hi,

I've a small problem for which I cannot find a solution and I'm quite sure 
there is an obvious one:

I've an array Z (any dtype) with some data.
I've a (sorted) array I (of integer, same size as Z) that tells me the  index 
of Z[i]  (if necessary, the index can be stored in Z).

Now, I have an arbitrary sequence S of indices (in the sense of I), how do I 
build the corresponding data ?

Here is a small example:

Z = [(0,0), (1,1), (2,2), (3,3), (4,4))
I  = [0, 20, 23, 24, 37]

S = [ 20,20,0,24]
-> Result should be [(1,1), (1,1), (0,0),(3,3)]

S = [15,15]
-> Wrong (15 not in I) but ideally, I would like this to be converted to 
[(0,0), (0,0)]


Any idea ?



Nicolas
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to