← union operator page · set/union/two/manual_ex_2
pandas ✅ · DuckDB ✅
union ( DS_1, DS_3 ): two data sets that share one data point, (2012, B, Total, Total), with the measure 5 in DS_1 and 23 in DS_3.
Union, Example 2, output verbatim: duplicate Data Points "are filtered by choosing the Data Point belonging to the left most operand Data Set".
the page's four data points: (2012, B, Total, Total) has the measure 5 of DS_1, the leftmost operand, and not the 23 of DS_3.
DS_r := union ( DS_1, DS_3 );
| Id_1 | Id_2 | Id_3 | Id_4 | Me_1 |
|---|---|---|---|---|
| 2012 | B | Total | Total | 5 |
| 2012 | G | Total | Total | 2 |
| 2012 | F | Total | Total | 3 |
{
"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}
]
}
]
}
| Id_1 | Id_2 | Id_3 | Id_4 | Me_1 |
|---|---|---|---|---|
| 2012 | B | Total | Total | 23 |
| 2012 | S | Total | Total | 5 |
{
"datasets": [
{
"name": "DS_3",
"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}
]
}
]
}
| Id_1 | Id_2 | Id_3 | Id_4 | Me_1 |
|---|---|---|---|---|
| 2012 | B | Total | Total | 5 |
| 2012 | G | Total | Total | 2 |
| 2012 | F | Total | Total | 3 |
| 2012 | S | Total | Total | 5 |
{
"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": "Me_1", "type": "Integer", "role": "Measure"}
]
}
]
}