← and operator page · boolean/and/comp_comp/all_four_boolean_combinations

All four boolean combinations 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

DS_1[calc Me_3 := Me_1 and Me_2]: ids 1 to 4 hold the four combinations of two boolean values.

Manual:

Logical conjunction: "The and operator returns true if both operands are true, otherwise false."

Expected:

Me_3 is true only for id 1, where both operands are true, and false for ids 2 to 4.

script.vtl ⇩

DS_r := DS_1[calc Me_3 := Me_1 and Me_2];

input/DS_1.csv ⇩

Id_1Me_1Me_2
1truetrue
2truefalse
3falsetrue
4falsefalse

input/DS_1.json ⇩

{
  "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}
      ]
    }
  ]
}

expected/DS_r.csv ⇩

Id_1Me_1Me_2Me_3
1truetruetrue
2truefalsefalse
3falsetruefalse
4falsefalsefalse

expected/DS_r.json ⇩

{
  "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"}
      ]
    }
  ]
}