← in operator page · comparison/in/ds_value_domain/manual_ex_3
pandas ✅ · DuckDB ✅
DS_1#Id_2 in myGeoValueDomain: the identifier Id_2, taken as a measure by the membership operator, against a value domain.
Element of, Example 3, output verbatim: "The in operator returns true if op belongs to the collection, false otherwise." The page defines the Value Domain myGeoValueDomain (string) in the text before its examples, not in their files, as {"AF", "BS", "FJ", "GA", "KH", "MO", "PK", "QA", "UG"}; it is passed to run as value_domains/myGeoValueDomain.json.
bool_var is true for BS, MO and FJ, which are elements of the value domain, and false for GZ, SQ and CQ, which are not.
DS_r := DS_1#Id_2 in myGeoValueDomain;
| 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 | true |
| 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"}
]
}
]
}
{
"name": "myGeoValueDomain",
"setlist": [
"AF",
"BS",
"FJ",
"GA",
"KH",
"MO",
"PK",
"QA",
"UG"
],
"type": "String"
}