← and operator page · boolean/and/ds_ds/manual_ex_1

Manual example 1 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

DS_1 and DS_2 on two data sets with the same identifiers and one boolean measure.

Manual:

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

Expected:

the page's six data points: Me_1 is true only for (M, 65, B, 2013), where both operands are true.

script.vtl ⇩

DS_r:= DS_1 and DS_2;

input/DS_1.csv ⇩

Id_1Id_2Id_3Id_4Me_1
M15B2013True
M64B2013False
M65B2013True
F15U2013False
F64U2013False
F65U2013True

input/DS_1.json ⇩

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

input/DS_2.csv ⇩

Id_1Id_2Id_3Id_4Me_1
M15B2013False
M64B2013True
M65B2013True
F15U2013True
F64U2013False
F65U2013False

input/DS_2.json ⇩

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

expected/DS_r.csv ⇩

Id_1Id_2Id_3Id_4Me_1
M15B2013false
M64B2013false
M65B2013true
F15U2013false
F64U2013false
F65U2013false

expected/DS_r.json ⇩

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