[Numpy-discussion] array.argmax() question
ryanlists at gmail.com
Thu Feb 23 18:09:00 CST 2006
Is this the expected behavior for array.argmax():
Out: (11, 3)
*** IndexError: invalid index
Basically, I want to find the element with the largest absolute value
in a matrix and use it to scale by. But I need to correct for the
possibility that the largest abs value may be from a negative number.
So, I need to get the corresponding element itself.
My array is shape (11,3) and argmax without an axis argument returns
32, which would be the index if the matrix was reshaped into a (33,)
vector. Is there a clean way to extract the element based on the
output of argmax? (and in my case it is actually using the output of
argmax to extract the element from the matrix without the abs). Or do
I need to reshape the matrix into a vector first?
More information about the Numpy-discussion