← membership operator page · general/membership/attribute/manual_ex_3
pandas ✅ · DuckDB ✅
DS_1#At_1 on a non-viral attribute: its values become a new measure, and the attribute itself is dropped.
Membership, Example 3: "A default conventional name is assigned to the new Measure depending on its type: for example num_var if the Measure is numeric, string_var if it is string".
Id_1, Id_2 and a String measure with the values of At_1; the values are the manual's.
The manual names the new measure string_var; the expected output names it str_var, vtlengine's default name for a String measure, documented in docs/data_types.rst. Default names "can be personalised in the implementations" (Typical behaviour).
DS_r := DS_1#At_1;
| Id_1 | Id_2 | Me_1 | Me_2 | At_1 |
|---|---|---|---|---|
| 1 | A | 1 | 5 | |
| 1 | B | 2 | 10 | P |
| 2 | A | 3 | 12 |
{
"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}
]
}
]
}
| Id_1 | Id_2 | str_var |
|---|---|---|
| 1 | A | |
| 1 | B | P |
| 2 | A |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Id_2", "type": "String", "role": "Identifier"},
{"name": "str_var", "type": "String", "role": "Measure"}
]
}
]
}