element-wise lookup on one ndarray to another ndarray of different shapes
- by fahhean
Hi,
I am new to numpy. Am wonder is there a way to do lookup of two ndarray of different shapes?
for example, i have 2 ndarrays as below:
X = array([[0, 3, 6],
[3, 3, 3],
[6, 0, 3]])
Y = array([[0, 100],
[3, 500],
[6, 800]])
and would like to lookup each element of X in Y, then be able to return the second column of Y:
Z = array([[100, 500, 800],
[500, 500, 500],
[800, 100, 500]])
thanks, fahhean