Nov-13-2017, 10:16 AM

Hi,

I implemented an algorithm in which I used the argmin() where the index of the smallest number in an array is returned to be used. Now, I would like to generalize my algorithm, and thus I want to return the indices of the smallest k numbers. So, I restored to argsort()[:k]. When I tested it for k = 1, I expected to get the same results as with argmin(), which wasn't the case. I noticed that argsort()[:1] returns an array, while argmin() returns a scalar. Could this be the issue? If not, what else could be?

Thanks