← membership operator page · general/membership/measure/manual_ex_1

Manual example 1 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

DS_1#Me_1: the measure is kept, and the other measure and the non-viral attribute are dropped.

Manual:

Membership, Example 1, output verbatim: "If comp is a Measure in ds, then comp is maintained in the result while all other Measures are dropped."

Expected:

Id_1, Id_2 and Me_1.

script.vtl ⇩

DS_r := DS_1#Me_1;

input/DS_1.csv ⇩

Id_1Id_2Me_1Me_2At_1
1A15
1B210P
2A312

input/DS_1.json ⇩

{
  "datasets": [
    {
      "name": "DS_1",
      "DataStructure": [
        {"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
        {"name": "Id_2", "type": "String", "role": "Identifier", "nullable": false},
        {"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true},
        {"name": "Me_2", "type": "Integer", "role": "Measure", "nullable": true},
        {"name": "At_1", "type": "String", "role": "Attribute", "nullable": true}
      ]
    }
  ]
}

expected/DS_r.csv ⇩

Id_1Id_2Me_1
1A1
1B2
2A3

expected/DS_r.json ⇩

{
  "datasets": [
    {
      "name": "DS_r",
      "DataStructure": [
        {"name": "Id_1", "type": "Integer", "role": "Identifier"},
        {"name": "Id_2", "type": "String", "role": "Identifier"},
        {"name": "Me_1", "type": "Integer", "role": "Measure"}
      ]
    }
  ]
}