Dictionaries
Take dictionaries in multiple columns and merge them to a single dictionary.
note
For duplicate keys, the last key in the input list takes precedence in the merged dictionary.
Parameters
| Name | Description | Accepted Values | Default | Required |
|---|---|---|---|---|
| I/O | ||||
input | List of input columns. | array | — | Yes |
output | Name of the output column. | string | — | Yes |
| Options | ||||
skip_empty | Whether to skip empty dictionaries when merging. | 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.dictionaries:
input:
- Dict 1
- Dict 2
output: Merged
| Dict 1 | Dict 2 |
|---|---|
| {'First': 'One'} | {'Second': 'Two'} |
| Merged |
|---|
| {'First': 'One', 'Second': 'Two'} |
# Using a Wildcard (*)
wrangles:
- merge.dictionaries:
input: Dict *
output: Merged
| Dict 1 | Dict 2 |
|---|---|
| {'First': 'One'} | {'Second': 'Two'} |
| Merged |
|---|
| {'First': 'One', 'Second': 'Two'} |
# Using a Wildcard (*)
wrangles:
- merge.dictionaries:
input:
- Dict *
- -Dict 2
output: Merged
Note the extra dash in front of Dict 2 excludes that column from the wildcard selection.
| Dict 1 | Dict 2 | Dict 3 |
|---|---|---|
| {'First': 'One'} | {'Second': 'Two'} | {'Third': 'Three'} |
| Merged |
|---|
| {'First': 'One', 'Third': 'Three'} |
Access
| Requirement | Value |
|---|---|
| AI-powered | No |
| Requires WrangleWorks account | No |
| Requires subscription | No |
| Requires external API key | No |
Technical details
| Field | Value |
|---|---|
| Catalog ID | 42 |
| Catalog key | merge.dictionaries |
| Recipe key | merge.dictionaries |
| Catalog status | active |
| Lifecycle status | active |
| Recipe Writer eligible | Yes |
| Namespace | merge |
| Documentation group | merge |
| Aliases | None |
| Runtime symbol | wrangles.recipe_wrangles.merge.dictionaries |
| Legacy UUID | 93e27737-e966-4ba9-8777-4e96724ebfc4 |
Sources