Hi I have a numpy array for eg.
arr = np.random.rand(4,5)
array([[0.70733982, 0.1770464 , 0.55588376, 0.8810145 , 0.43711158],
[0.22056565, 0.0193138 , 0.89995761, 0.75157581, 0.21073093],
[0.22333035, 0.92795789, 0.3903581 , 0.41225472, 0.74992639],
[0.92328687, 0.20438876, 0.63975818, 0.6179422 , 0.40596821]])
I need to find the first three largest elements in the array.I tried
arr[[-arr.argsort(axis=-1)[:, :3]]]
I also referred this question on StackOverflow which only gives indices not values
I was able to get the indices of the first three max values,but how to get its corresponding values.?
Also I tried sorting the array by converting into list like given here
But didnt give me the required result.Any Ideas?