← exists_in operator page · comparison/exists_in/retain_all/manual_ex_1
pandas ✅ · DuckDB ✅
exists_in (DS_1, DS_2, all): every data point of DS_1 is returned, found in DS_2 or not.
Exists in, Example 1, output verbatim: "If retain is all then both the Data Points having bool_var = true and bool_var = false are returned."
bool_var is true for B, S, F and W, and false for G and M, which DS_2 has only with Id_4 = M, where DS_1 has Total; all six data points are returned.
DS_r := exists_in (DS_1, DS_2, all);
| Id_1 | Id_2 | Id_3 | Id_4 | Me_1 |
|---|---|---|---|---|
| 2012 | B | Total | Total | 11094850 |
| 2012 | G | Total | Total | 11123034 |
| 2012 | S | Total | Total | 46818219 |
| 2012 | M | Total | Total | 417546 |
| 2012 | F | Total | Total | 5401267 |
| 2012 | W | Total | Total | 7954662 |
{
"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 | 0.023 |
| 2012 | G | Total | M | 0.286 |
| 2012 | S | Total | Total | 0.064 |
| 2012 | M | Total | M | 0.043 |
| 2012 | F | Total | Total | |
| 2012 | W | Total | Total | 0.08 |
{
"datasets": [
{
"name": "DS_2",
"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": "Number", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | Id_3 | Id_4 | bool_var |
|---|---|---|---|---|
| 2012 | B | Total | Total | true |
| 2012 | G | Total | Total | false |
| 2012 | S | Total | Total | true |
| 2012 | M | Total | Total | false |
| 2012 | F | Total | Total | true |
| 2012 | W | Total | Total | true |
{
"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": "bool_var", "type": "Boolean", "role": "Measure"}
]
}
]
}