3.16 Inter-sequence computation: check whether two sequences are equal
Compare whether all members at corresponding positions in two sequences are equal.
Find whether two random sampling select same IDs based on the random sampling file. Below is part of the file:
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 cmp() function performs alignment comparison on members of two sequences:
SPL script:
A | |
---|---|
1 | =T(“p_old.xlsx”) |
2 | =T(“p_new.xlsx”) |
3 | =cmp(A1.(ID),A2.(ID)) |
A1 Retrieve the file output the first time.
A2 Retrieve the file output the second time.
A3 Compare whether two files generate ID fields having same values and orders.
Execution result:
Member |
---|
0 |
The result of 0 means the two files have completely same IDs.
If IDs of the two files have different orders, use eq() function to compare whether they contain same members:
A | |
---|---|
3 | =A1.(ID).eq(A2.(ID)) |
A3 Compare whether two files generate same ID values. It is not required that they have same order in this case.
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