Reputation: 17617
Given an array I need to find the minimum and the position of the minimum. This can be done using
>>> current_cost
array([ 2.54802261, 2.98627555, 0.23873749, 1.82511195, 1.35469083])
>>> current_cost.min()
0.23873748917821858
>>> current_cost.argmin()
2
This solutions is not very efficient because it needs to scan the list two times. Is there a way to obtain minimum and agrmin at the same time?
Upvotes: 21
Views: 12793