Many array methods return a single index, despite the fact that the array is multidimensional. For instance:
a = rand(2,3)
z = a.argmax()
For two dimensions, it is easy to find the matrix indices of the maximum element:
a[z/3, z%3]
But for more measurements, this can be annoying. Does Numpy / Scipy have an easy way to return indexes in multiple dimensions, given the index in one (collapsed) dimension? Thank.
source
share