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

Manual example 1 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

DS_1 < 15000000: every measure value of DS_1 against a scalar, with a null measure.

Manual:

Less than, Example 1, output verbatim: "The operator < returns true if left is smaller than right, false otherwise."

Expected:

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

script.vtl ⇩

DS_r := DS_1 < 15000000;

input/DS_1.csv ⇩

Id_1Id_2Id_3Id_4Me_1
2012BTotalTotal11094850
2012GTotalTotal11123034
2012STotalTotal46818219
2012MTotalTotal
2012FTotalTotal5401267
2012WTotalTotal7954662

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": "Integer", "role": "Measure", "nullable": true}
      ]
    }
  ]
}

expected/DS_r.csv ⇩

Id_1Id_2Id_3Id_4bool_var
2012BTotalTotaltrue
2012GTotalTotaltrue
2012STotalTotalfalse
2012MTotalTotal
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"}
      ]
    }
  ]
}