我有以下形式的数据:id,val1,val2
例子
1,0.2,0.1
1,0.1,0.7
1,0.2,0.3
2,0.7,0.9
2,0.2,0.3
2,0.4,0.5
所以首先我想按 val1 以降序对每个 id 进行排序..so somethng like
1,0.2,0.1
1,0.2,0.3
1,0.1,0.7
2,0.7,0.9
2,0.4,0.5
2,0.2,0.3
然后为每个 id 选择第二个元素 id,val2 组合所以例如:
1,0.3
2,0.5
我该如何处理?
谢谢