4.18 Rank groups
Find ranks of average math scores of classes:
Class | Name | Math |
---|---|---|
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 | 92 |
2 | Jack | 86 |
1 | Joe | 98 |
SPL script:
A | |
---|---|
1 | =T(“score.xlsx”) |
2 | =A1.groups(Class;avg(Math):avgMath) |
3 | =A2.ranks@z(avgMath) |
4 | =A2.new(Class,A3(#):Rank) |
A2 Group score table by class and calculate the average math score in each class.
A3 Rank average math scores of all classes.
A4 Generate a new table sequence containing Class field and Rank field.
Execution result:
Class | Rank |
---|---|
1 | 1 |
2 | 2 |
SPL Official Website 👉 https://www.scudata.com
SPL Feedback and Help 👉 https://www.reddit.com/r/esProc_SPL
SPL Learning Material 👉 https://c.scudata.com
SPL Source Code and Package 👉 https://github.com/SPLWare/esProc
Discord 👉 https://discord.gg/cFTcUNs7
Youtube 👉 https://www.youtube.com/@esProc_SPL