← symdiff operator page · set/symdiff/two/manual_ex_1
pandas ✅ · DuckDB ✅
symdiff ( DS_1, DS_2 ): five data points are in both operands, one is only in DS_1 and one only in DS_2.
Symmetric difference, Example 1, output verbatim: the operator returns a Data Set "containing the Data Points that appear in the first Data Set but not in the second and the Data Points that appear in the second Data Set but not in the first one".
the page's two data points, one from each operand: (2012, B, Total, Total) and (2011, B, Total, Total), both with the measure 1.
DS_r := symdiff ( DS_1, DS_2 );
| Id_1 | Id_2 | Id_3 | Id_4 | Me_1 |
|---|---|---|---|---|
| 2012 | B | Total | Total | 1 |
| 2012 | G | Total | Total | 2 |
| 2012 | F | Total | Total | 3 |
| 2012 | M | Total | Total | 4 |
| 2012 | I | Total | Total | 5 |
| 2012 | S | Total | Total | 6 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Id_2", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Id_3", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Id_4", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | Id_3 | Id_4 | Me_1 |
|---|---|---|---|---|
| 2011 | B | Total | Total | 1 |
| 2012 | G | Total | Total | 2 |
| 2012 | F | Total | Total | 3 |
| 2012 | M | Total | Total | 4 |
| 2012 | I | Total | Total | 5 |
| 2012 | S | Total | Total | 6 |
{
"datasets": [
{
"name": "DS_2",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Id_2", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Id_3", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Id_4", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | Id_3 | Id_4 | Me_1 |
|---|---|---|---|---|
| 2012 | B | Total | Total | 1 |
| 2011 | B | Total | Total | 1 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Id_2", "type": "String", "role": "Identifier"},
{"name": "Id_3", "type": "String", "role": "Identifier"},
{"name": "Id_4", "type": "String", "role": "Identifier"},
{"name": "Me_1", "type": "Integer", "role": "Measure"}
]
}
]
}