← sub operator page · clause/sub/multi_id/manual_ex_1
pandas ✅ · DuckDB ✅
sub Id_1 = 1, Id_2 = "A": two of the three identifiers fixed.
Subspace, Example 1, output verbatim: "It maintains the Data Points of VDS for which identifier = value (for all the specified identifier) and eliminates all the Data Points for which identifier <> value (even for only one specified identifier)", then "It projects out (“drops”, in VTL terms) all the identifier (s)".
The two data points with Id_1 = 1 and Id_2 = A, without these two identifiers: Id_3, Me_1 and At_1 = XX, 20, F and YY, 1, F.
DS_r := DS_1 [ sub Id_1 = 1, Id_2 = "A" ];
| Id_1 | Id_2 | Id_3 | Me_1 | At_1 |
|---|---|---|---|---|
| 1 | A | XX | 20 | F |
| 1 | A | YY | 1 | F |
| 1 | B | XX | 4 | E |
| 1 | B | YY | 9 | F |
| 2 | A | XX | 7 | F |
| 2 | A | YY | 5 | E |
| 2 | B | XX | 12 | F |
| 2 | B | YY | 15 | F |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Id_2", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Id_3", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true},
{"name": "At_1", "type": "String", "role": "Attribute", "nullable": true}
]
}
]
}
| Id_3 | Me_1 | At_1 |
|---|---|---|
| XX | 20 | F |
| YY | 1 | F |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_3", "type": "String", "role": "Identifier"},
{"name": "Me_1", "type": "Integer", "role": "Measure"},
{"name": "At_1", "type": "String", "role": "Attribute"}
]
}
]
}