← and operator page · boolean/and/comp_comp/all_four_boolean_combinations
pandas ✅ · DuckDB ✅
DS_1[calc Me_3 := Me_1 and Me_2]: ids 1 to 4 hold the four combinations of two boolean values.
Logical conjunction: "The and operator returns true if both operands are true, otherwise false."
Me_3 is true only for id 1, where both operands are true, and false for ids 2 to 4.
DS_r := DS_1[calc Me_3 := Me_1 and Me_2];
| Id_1 | Me_1 | Me_2 |
|---|---|---|
| 1 | true | true |
| 2 | true | false |
| 3 | false | true |
| 4 | false | false |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Boolean", "role": "Measure", "nullable": true},
{"name": "Me_2", "type": "Boolean", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Me_1 | Me_2 | Me_3 |
|---|---|---|---|
| 1 | true | true | true |
| 2 | true | false | false |
| 3 | false | true | false |
| 4 | false | false | false |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Me_1", "type": "Boolean", "role": "Measure"},
{"name": "Me_2", "type": "Boolean", "role": "Measure"},
{"name": "Me_3", "type": "Boolean", "role": "Measure"}
]
}
]
}