← in operator page · comparison/in/ds_set/manual_ex_1
pandas ✅ · DuckDB ✅
DS_1 in { 0, 3, 6, 12 }: every measure value of DS_1 against a set literal.
Element of, Example 1, output verbatim: "The in operator returns true if op belongs to the collection, false otherwise."
bool_var is true for BS (0) and MO (6), and false for GZ, SQ, FJ and CQ (4, 9, 7 and 2).
DS_r := DS_1 in { 0, 3, 6, 12 };
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 2012 | BS | 0 |
| 2012 | GZ | 4 |
| 2012 | SQ | 9 |
| 2012 | MO | 6 |
| 2012 | FJ | 7 |
| 2012 | CQ | 2 |
{
"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": "Me_1", "type": "Integer", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | bool_var |
|---|---|---|
| 2012 | BS | true |
| 2012 | GZ | false |
| 2012 | SQ | false |
| 2012 | MO | true |
| 2012 | FJ | false |
| 2012 | CQ | false |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Time_Period", "role": "Identifier"},
{"name": "Id_2", "type": "String", "role": "Identifier"},
{"name": "bool_var", "type": "Boolean", "role": "Measure"}
]
}
]
}