4.10 组内排序
有数据如下:
Class | Name | Maths |
---|---|---|
1 | Tom | 85 |
2 | John | 92 |
2 | Joan | 86 |
1 | Rocky | 95 |
2 | Ham | 92 |
1 | Kate | 83 |
1 | Rose | 95 |
2 | Nomy | 78 |
1 | Neil | 91 |
2 | Jack | 84 |
1 | Joe | 98 |
将数据按照班级分组、班级内部按成绩 (降序) 的规则排序:
脚本:
A | |
---|---|
1 | =T(“score.xlsx”).group(Class).(~.sort@z(Maths)).conj() |
运行结果:
Class | Name | Maths |
---|---|---|
1 | Joe | 98 |
1 | Rocky | 95 |
1 | Rose | 95 |
1 | Neil | 91 |
1 | Tom | 85 |
1 | Kate | 83 |
2 | John | 92 |
2 | Ham | 92 |
2 | Joan | 86 |
2 | Jack | 84 |
2 | Nomy | 78 |