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
| Name | Description | Accepted Values | Default | Required |
|---|---|---|---|---|
| I/O | ||||
input | Matched pairs of key and value columns. | object | — | Yes |
output | Name of the output column. | string | — | Yes |
| Options | ||||
skip_empty | Whether to skip empty keys or values when creating the dictionary. | boolean | false | No |
| Conditions | ||||
if | Condition that determines whether the wrangle runs as a whole. Recipe variables may be referenced with ${variable}. | string | — | No |
where | Filter rows before applying the wrangle using SQL-like criteria, such as column1 = 123 OR column2 = 'abc'. | string | — | No |
where_params | Values 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
| Letter | Number |
|---|---|
| A | 1 |
| B | 2 |
| C | 3 |
| Pairs |
|---|
| {'A': 1} |
| {'B': 2} |
| {'C': 3} |
# Using a Wildcard (*)
wrangles:
- merge.key_value_pairs:
input:
key*: value*
output: Object
| key 1 | key 2 | value 1 | value 2 |
|---|---|---|---|
| A | One | a | First |
| B | Two | b | Second |
| C | three | c | Third |
| Object |
|---|
| {'A': 'a', 'One': 'First'} |
| {'B': 'b', 'Two': 'Second'} |
| {'C': 'c', 'three': 'Third'} |
Access
| Requirement | Value |
|---|---|
| AI-powered | No |
| Requires WrangleWorks account | No |
| Requires subscription | No |
| Requires external API key | No |
Technical details
| Field | Value |
|---|---|
| Catalog ID | 43 |
| Catalog key | merge.key_value_pairs |
| Recipe key | merge.key_value_pairs |
| Catalog status | active |
| Lifecycle status | active |
| Recipe Writer eligible | Yes |
| Namespace | merge |
| Documentation group | merge |
| Aliases | None |
| Runtime symbol | wrangles.recipe_wrangles.merge.key_value_pairs |
| Legacy UUID | 8a2cd37c-8ef7-4b05-8264-36512f5dd837 |
Sources