3.22 Merge same-order sequences in the original order and calculate XOR

 

Merge records of two same-structure tables in the original order by a certain field and retain the non-duplicated records only.
Compare two random sampling files and find the number of their different IDs.

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 script:

A
1 =T(“p1.xlsx”)
2 =T(“p2.xlsx”)
3 =A1.sort(ID)
4 =A2.sort(ID)
5 =[A3,A4].merge@x(ID)
6 =A5.len()

A1 Retrieve the first random sampling file.
A2 Retrieve the second random sampling file.
A3 Sort the first file by ID.
A4 Sort the second file by ID.
A5 merge function works with @x option to merge two files by ID and return records having different IDs.
A6 Get the number of different IDs.

Execution result:

Value
458