← cross_join operator page · join/cross_join/apply/sum_of_homonym_measures
pandas ✅ · DuckDB ✅
apply DS_1 + DS_2, written with the data set names, on the homonym measure Me_1.
Cross Join: apply "applies the expression to each of the n-uple of homonym Measures in the input data sets producing in the target a single homonym Measure for each n-uple", and "All the input measures do not appear".
the cartesian product of DS_1 (Id_1 1, 2) and DS_2 (Id_2 A, B) has 2 × 2 = 4 data points, with DS_1#Me_1 and DS_2#Me_1: Me_1 is 11, 12, 21 and 22.
DS_r := cross_join(DS_1, DS_2 apply DS_1 + DS_2);
| Id_1 | Me_1 |
|---|---|
| 1 | 10 |
| 2 | 20 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Number", "role": "Measure", "nullable": true}
]
}
]
}
| Id_2 | Me_1 |
|---|---|
| A | 1 |
| B | 2 |
{
"datasets": [
{
"name": "DS_2",
"DataStructure": [
{"name": "Id_2", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Number", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 11 |
| 1 | B | 12 |
| 2 | A | 21 |
| 2 | B | 22 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Id_2", "type": "String", "role": "Identifier"},
{"name": "Me_1", "type": "Number", "role": "Measure"}
]
}
]
}