← intersect operator page · set/intersect/n/point_in_all_three_operands
pandas ✅ · DuckDB ✅
intersect(DS_1, DS_2, DS_3), the list form with three operands, where the page's example has two: ids 3 and 4 are in all three, and ids 1, 2 and 5 are each in two, lacking DS_2, DS_3 and DS_1 in turn. The measure is 10 * Id_1 + k, with k 0, 1 and 2 for DS_1, DS_2 and DS_3.
Intersection: dsList ::= ds { , ds }*, the resulting Data Set "contains the Data Points belonging to all the operand Data Sets", and duplicate Data Points "are filtered by choosing the Data Point belonging to the leftmost operand Data Set".
Me_1 is 30 and 40 for ids 3 and 4, the values of DS_1. Leaving out DS_1, DS_2 or DS_3 would add id 5, 1 or 2, so every operand takes part in the intersection.
DS_r := intersect(DS_1, DS_2, DS_3);
| Id_1 | Me_1 |
|---|---|
| 1 | 10 |
| 2 | 20 |
| 3 | 30 |
| 4 | 40 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Me_1 |
|---|---|
| 2 | 21 |
| 3 | 31 |
| 4 | 41 |
| 5 | 51 |
{
"datasets": [
{
"name": "DS_2",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Me_1 |
|---|---|
| 1 | 12 |
| 3 | 32 |
| 4 | 42 |
| 5 | 52 |
{
"datasets": [
{
"name": "DS_3",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Me_1 |
|---|---|
| 3 | 30 |
| 4 | 40 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Me_1", "type": "Integer", "role": "Measure"}
]
}
]
}