Skip to main content

Key Value Pairs

Create a dictionary from keys and values in paired columns e.g. COLUMN_NAME_1, COLUMN_VALUE_1, COLUMN_NAME_2, COLUMN_VALUE_2 ...

Create a dictionary from keys and values in paired columns.

Parameters​

NameDescriptionAccepted ValuesDefaultRequired
I/O
inputMatched pairs of key and value columns.object—Yes
outputName of the output column.string—Yes
Options
skip_emptyWhether to skip empty keys or values when creating the dictionary.booleanfalseNo
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

Examples​

wrangles:
- merge.key_value_pairs:
input:
Letter: Number
output: Pairs
LetterNumber
A1
B2
C3
Pairs
{'A': 1}
{'B': 2}
{'C': 3}
# Using a Wildcard (*)
wrangles:
- merge.key_value_pairs:
input:
key*: value*
output: Object
key 1key 2value 1value 2
AOneaFirst
BTwobSecond
CthreecThird
Object
{'A': 'a', 'One': 'First'}
{'B': 'b', 'Two': 'Second'}
{'C': 'c', 'three': 'Third'}
Access
RequirementValue
AI-poweredNo
Requires WrangleWorks accountNo
Requires subscriptionNo
Requires external API keyNo
Technical details
FieldValue
Catalog ID43
Catalog keymerge.key_value_pairs
Recipe keymerge.key_value_pairs
Catalog statusactive
Lifecycle statusactive
Recipe Writer eligibleYes
Namespacemerge
Documentation groupmerge
AliasesNone
Runtime symbolwrangles.recipe_wrangles.merge.key_value_pairs
Legacy UUID8a2cd37c-8ef7-4b05-8264-36512f5dd837

Sources