← membership operator page · general/membership/identifier/manual_ex_2
pandas ✅ · DuckDB ✅
DS_1#Id_1: the values of an identifier become a new measure, named for its type.
Membership, Example 2, output verbatim: "If comp is an Identifier or an Attribute Component in ds, then all the existing Measures of ds are dropped in the result and a new Measure is added."
Id_1, Id_2 and the measure int_var with the values of Id_1; the measures and the non-viral At_1 are dropped.
DS_r := DS_1#Id_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 | int_var |
|---|---|---|
| 1 | A | 1 |
| 1 | B | 1 |
| 2 | A | 2 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Id_2", "type": "String", "role": "Identifier"},
{"name": "int_var", "type": "Integer", "role": "Measure"}
]
}
]
}