i have array like this :
array([[2, 1],
[3, 5],
[2, 1],
[4, 2],
[2, 3],
[5, 3]])
What i want to do is 'group-by' sum by first column and then sort by second column :
array([[2, 5],
[3, 5],
[5, 3],
[4, 2]])
and here comes the twist, I want to also get back the indexes from the original array of every row in the result array, sorted :
2 3 5 4
[[0,2,4], [1], [5], [3] ]
OR if its easy .. i need to get the top N indexes ... let say top 2 :
2 3
[0,2,4, 1]
No pandas, only pure numpy.
BTW, i need only the top N items and their indexes .. this may simplify speedup the process
trying to apply any of this: