Skip to main content

Dictionary Element

Select one or more element of a dictionary.

Parameters​

NameDescriptionAccepted ValuesDefaultRequired
I/O
inputName of the input column.string, integer, array—Yes
outputName of the output column. If omitted, the input column will be replaced.string, array, nullnullNo
Options
elementThe key or keys from the dictionary to select. If a single key is provided, the value will be returned If a lists of keys are selected, the result will be a new dictionary.string—Yes
Conditions
ifCondition that determines whether the wrangle runs as a whole. Recipe variables may be referenced with ${variable}.string—No
whereFilter rows before applying the wrangle using SQL-like criteria, such as column1 = 123 OR column2 = 'abc'.string—No
where_paramsValues used with where for parameterized criteria. Uses SQLite placeholder syntax such as ? or :name.array, object—No
Errors
defaultSet the default value to return if the specified element doesn't exist. If selecting multiple elements, a dict of defaults can be set.string, number, array, object, boolean, null""No

Examples​

wrangles:
- select.dictionary_element:
input: Properties
output: Shapes
element: shapes
default: square
where: Part Number = 1234
PropertiesPart Number
{'colours': ['red', 'white', 'blue'], 'shapes': 'round', 'materials': 'tungsten'}1234
{'colours': ['green', 'yellow', 'orange'], 'shapes': 'square', 'materials': 'tungsten'}5678
Shapes
round
wrangles:
- select.dictionary_element:
input: Properties
element:
- shapes
- materials
Properties
{'colours': ['red', 'white', 'blue'], 'shapes': 'round', 'materials': 'tungsten'}
{'colours': ['green', 'yellow', 'orange'], 'shapes': 'square', 'materials': 'tungsten'}
Properties
{'shapes': 'round', 'materials': 'tungsten'}
{'shapes': 'square', 'materials': 'tungsten'}
wrangles:
- select.dictionary_element:
input: Properties
output: Output Dict
element:
- Col*
Column
{'Col1': 'A', 'Col2': 'B', 'Other3': 'C'}
ColumnOutput Dict
{'Col1': 'A', 'Col2': 'B', 'Col3': 'C'}{'Col1': 'A', 'Col2': 'B'}
wrangles:
- select.dictionary_element:
input: Properties
output: Output Dict
element:
- "regex: .*2"
Column
{'Col1': 'A', 'Col2': 'B', 'Col3': 'C'}
Output Dict
{'Col2': 'B'}
wrangles:
- select.dictionary_element:
input: Properties
output: Output Dict
element:
- Col1: Column 1
- Col2: Column 2
Column
{'Col1': 'A', 'Col2': 'B', 'Col3': 'C'}
Output Dict
{'Column 1': 'A', 'Column 2': 'B'}
wrangles:
- select.dictionary_element:
input: Properties
output: Output Dict
element:
- Col1
- Col3
default:
Col1: Z
Col3: Y
Column
{'Col1': 'A', 'Col2': 'B', 'Col3': 'C'}
{'Col1': 'D', 'Col2': 'E'}
Output Dict
{'Col1': 'A', 'Col3': 'C'}
{'Col1': 'D', 'Col3': 'Y'}
Access
RequirementValue
AI-poweredNo
Requires WrangleWorks accountNo
Requires subscriptionNo
Requires external API keyNo
Technical details
FieldValue
Catalog ID50
Catalog keyselect.dictionary_element
Recipe keyselect.dictionary_element
Catalog statusactive
Lifecycle statusactive
Recipe Writer eligibleYes
Namespaceselect
Documentation groupselect
AliasesNone
Runtime symbolwrangles.recipe_wrangles.select.dictionary_element
Legacy UUID5adaeada-6da8-464f-84cb-9fb5ecc17e48

Sources