← addition operator page · numeric/addition/ds_ds/manual_ex_1
pandas ✅ · DuckDB ✅
the sum of each measure of DS_1 and the same measure of DS_2, on the data points that the two datasets share.
Addition, Example 1, output verbatim: "The operator addition returns the sum of two numbers."
only (10, A) and (11, B) are in both datasets: 5 + 10 = 15 and 5.0 + 3.0 = 8.0; 4 + 6 = 10 and 20.3 + 7.0 = 27.3.
DS_r := DS_1 + DS_2;
| Id_1 | Id_2 | Me_1 | Me_2 |
|---|---|---|---|
| 10 | A | 5 | 5.0 |
| 10 | B | 2 | 10.5 |
| 11 | A | 3 | 12.2 |
| 11 | B | 4 | 20.3 |
{
"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": "Number", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | Me_1 | Me_2 |
|---|---|---|---|
| 10 | A | 10 | 3.0 |
| 10 | C | 11 | 6.2 |
| 11 | B | 6 | 7.0 |
{
"datasets": [
{
"name": "DS_2",
"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": "Number", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | Me_1 | Me_2 |
|---|---|---|---|
| 10 | A | 15 | 8.0 |
| 11 | B | 10 | 27.3 |
{
"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"},
{"name": "Me_2", "type": "Number", "role": "Measure"}
]
}
]
}