← xor operator page · boolean/xor/ds_ds/manual_ex_1
pandas ✅ · DuckDB ✅
DS_1 xor DS_2 on two data sets with the same identifiers and one boolean measure.
Exclusive disjunction, Example 1, output verbatim: "The xor operator returns true if only one of the operand is true (but not both), false otherwise."
the page's six data points: Me_1 is true where exactly one operand is true, and false for (M, 65, B, 2013), where both are true, and (F, 64, U, 2013), where both are false.
DS_r:=DS_1 xor DS_2;
| Id_1 | Id_2 | Id_3 | Id_4 | Me_1 |
|---|---|---|---|---|
| M | 15 | B | 2013 | True |
| M | 64 | B | 2013 | False |
| M | 65 | B | 2013 | True |
| F | 15 | U | 2013 | False |
| F | 64 | U | 2013 | False |
| F | 65 | U | 2013 | True |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Id_2", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Id_3", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Id_4", "type": "Time_Period", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Boolean", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | Id_3 | Id_4 | Me_1 |
|---|---|---|---|---|
| M | 15 | B | 2013 | False |
| M | 64 | B | 2013 | True |
| M | 65 | B | 2013 | True |
| F | 15 | U | 2013 | True |
| F | 64 | U | 2013 | False |
| F | 65 | U | 2013 | False |
{
"datasets": [
{
"name": "DS_2",
"DataStructure": [
{"name": "Id_1", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Id_2", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Id_3", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Id_4", "type": "Time_Period", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Boolean", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | Id_3 | Id_4 | Me_1 |
|---|---|---|---|---|
| M | 15 | B | 2013 | true |
| M | 64 | B | 2013 | true |
| M | 65 | B | 2013 | false |
| F | 15 | U | 2013 | true |
| F | 64 | U | 2013 | false |
| F | 65 | U | 2013 | true |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "String", "role": "Identifier"},
{"name": "Id_2", "type": "Integer", "role": "Identifier"},
{"name": "Id_3", "type": "String", "role": "Identifier"},
{"name": "Id_4", "type": "Time_Period", "role": "Identifier"},
{"name": "Me_1", "type": "Boolean", "role": "Measure"}
]
}
]
}