Hi, Apologies if the following is a trivial question. I wish to index the columns of the following 2D array
In [78]: neighbourhoods Out[78]: array([[8, 0, 1], [0, 1, 2], [1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5, 6], [5, 6, 7], [6, 7, 8], [7, 8, 0]]) using the integer array In [76]: perf[neighbourhoods].argmax(axis=1) Out[76]: array([2, 1, 0, 2, 1, 0, 0, 2, 1]) to produce a 9-element array but can't find a way of applying the indices to the columns rather than the rows. Is this do-able without using loops? The looped version of what I want is np.array( [neighbourhoods[i][perf[neighbourhoods].argmax(axis=1)[i]] for i in xrange(neighbourhoods.shape[0])] ) Regards, -- Will Furnass Doctoral Student Pennine Water Group Department of Civil and Structural Engineering University of Sheffield Phone: +44 (0)114 22 25768 _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion