3.17 Perform computation between a sequence and a single value
IDs of two files have same order and we want to find how many records are completely the same.
ID | Predicted_Y | Original_Y |
---|---|---|
10 | 0.012388464367608093 | 0.0 |
11 | 0.01519899123978988 | 0.0 |
13 | 0.0007920238885061248 | 0.0 |
19 | 0.0012656367468159102 | 0.0 |
21 | 0.009460545997473379 | 0.0 |
23 | 0.024176791871681664 | 0.0 |
… | … | … |
SPL uses “|” to combine a sequence and a single value.
SPL script:
A | B | |
---|---|---|
1 | =T(“p_old.xlsx”) | |
2 | =T(“p_new.xlsx”) | |
3 | for A1.len() | =cmp(A1(A3),A2(A3)) |
4 | =@ | B3 | |
5 | =B4.count(~==0) |
A1 Retrieve the file output the first time.
A2 Retrieve the file output the second time.
B3 Loop through each pair of records in the two files to compare them.
B4 Concatenate each comparison result to B4’s value.
A5 Count how many pairs of records are equal.
B4’s result:
Member |
---|
0 |
0 |
0 |
… |
A5’s result:
Member |
---|
11302 |
SPL Official Website 👉 https://www.scudata.com
SPL Feedback and Help 👉 https://www.reddit.com/r/esProcSPL
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