0

I know I can get the minimum value of a numpy matrix column-wise using:

my_array.min(axis=0)

But is there any way to efficiently get equivalent index/row instead of the values them-self? For instance:

my_array = [[10, 2, 3], [1, 3, 10], [20, 19, 0]]

I expect to get something like this:

[1, 0, 2] >> location of minimum values instead of values.

1
  • 2
    You should use np.argmin Commented Jun 27, 2018 at 6:27

1 Answer 1

1

You can use argmin instead

>>> my_array = [[10, 2, 3], [1, 3, 10], [20, 19, 0]]
>>> a=np.array(my_array)
>>> np.argmin(a, axis=0)
array([1, 0, 2])
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.