> Message: 6 > Date: Sat, 24 Nov 2012 20:36:45 +0000 > From: Siegfried Gonzi <[email protected]> > Subject: [Numpy-discussion] numpy where function on different size > Hi all >This must have been answered in the past but my google search > capabilities are not the best. >Given an array A say of dimension 40x60 and given another array/vector B > of dimension 20 (the values in B occur only once). >What I would like to do is the following which of course does not work > (by the way doesn't work in IDL either): >indx=where(A == B) >I understand A and B are both of different dimensions. So my question: > what would the fastest or proper way to accomplish this (I found a > solution but think is rather awkward and not very scipy/numpy-tonic > tough).
I should clarify: where(A==B, C, A) C is of equal dimension than B. Basically: everywhere where A equals e.g. B[0] replace by C[0]; or where B[4] equals A replace very occurence in A by C[4]. -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. _______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
