← equal operator page · comparison/equal/ds_sc/manual_ex_1

Manual example 1 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

DS_1 = 0.08: every measure value of DS_1 against a scalar, with a null measure.

Manual:

Equal to, Example 1, output verbatim: "The operator returns true if the left is equal to right, false otherwise."

Expected:

bool_var is true for F and W, whose measure is 0.08, false for G, S and M, and null for B, whose measure is null.

script.vtl ⇩

DS_r := DS_1 = 0.08;

input/DS_1.csv ⇩

Id_1Id_2Id_3Id_4Me_1
2012BTotalTotal
2012GTotalTotal0.286
2012STotalTotal0.064
2012MTotalTotal0.043
2012FTotalTotal0.08
2012WTotalTotal0.08

input/DS_1.json ⇩

{
  "datasets": [
    {
      "name": "DS_1",
      "DataStructure": [
        {"name": "Id_1", "type": "Time_Period", "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": "Number", "role": "Measure", "nullable": true}
      ]
    }
  ]
}

expected/DS_r.csv ⇩

Id_1Id_2Id_3Id_4bool_var
2012BTotalTotal
2012GTotalTotalfalse
2012STotalTotalfalse
2012MTotalTotalfalse
2012FTotalTotaltrue
2012WTotalTotaltrue

expected/DS_r.json ⇩

{
  "datasets": [
    {
      "name": "DS_r",
      "DataStructure": [
        {"name": "Id_1", "type": "Time_Period", "role": "Identifier"},
        {"name": "Id_2", "type": "String", "role": "Identifier"},
        {"name": "Id_3", "type": "String", "role": "Identifier"},
        {"name": "Id_4", "type": "String", "role": "Identifier"},
        {"name": "bool_var", "type": "Boolean", "role": "Measure"}
      ]
    }
  ]
}