I'm trying to get the indices of the maximum element in a Numpy array.
This can be done using numpy.argmax
. My problem is, that I would like to find the biggest element in the whole array and get the indices of that.
numpy.argmax
can be either applied along one axis, which is not what I want, or on the flattened array, which is kind of what I want.
My problem is that using numpy.argmax
with axis=None
returns the flat index when I want the multi-dimensional index.
I could use divmod
to get a non-flat index but this feels ugly. Is there any better way of doing this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…