Dictionary
Split one or more dictionaries into columns. The dictionary keys will be returned as the new column headers. If the dictionaries contain overlapping values, the last value will be returned.
Split a dictionary into columns. The dictionary keys are used as the new column headers.
Parameters
| Name | Description | Accepted Values | Default | Required |
|---|---|---|---|---|
| I/O | ||||
input | Name or lists of the column(s) containing dictionaries to be split. If providing multiple dictionaries and the dictionaries contain overlapping values, the last value will be returned. | string, integer, array | — | Yes |
output | In columns output_format, this is an optional subset of keys to extract from the dictionary. If not provided, all keys will be returned. Columns can be renamed with the following syntax: output: - key1: new_column_name1 - key2: new_column_name2 In to_lists output_format, this must be two output columns for the keys and values lists. If not provided, Keys and Values will be used. | string, array, null | null | No |
| Formatting | ||||
output_format | How to split the dictionary. columns creates one output column for each dictionary key. to_lists creates two output columns containing lists of keys and values. | string; one of:
| "columns" | 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 |
| Errors | ||||
default | Provide a set of default headings and values if they are not found within the input. | object, null | null | No |
Examples
wrangles:
- split.dictionary:
input: Column
# Output not required
| Column |
|---|
| {'Col1': 'A', 'Col2': 'B', 'Col3': 'C'} |
| Col1 | Col2 | Col3 |
|---|---|---|
| A | B | C |
wrangles:
- split.dictionary:
input: Column
output: Col2
| Column |
|---|
| {'Col1': 'A', 'Col2': 'B', 'Col3': 'C'} |
| Col2 |
|---|
| B |
wrangles:
- split.dictionary:
input: Column
output: Col*
| Column |
|---|
| {'Col1': 'A', 'Col2': 'B', 'Other': 'C'} |
| Col1 | Col2 |
|---|---|
| A | B |
wrangles:
- split.dictionary:
input: Column
output: "regex: .*3"
| Column |
|---|
| {'Col1': 'A', 'Col2': 'B', 'Col3': 'C'} |
| Col3 |
|---|
| C |
wrangles:
- split.dictionary:
input: Column
output:
- Col1: Column 1
- Col2: Column 2
| Column |
|---|
| {'Col1': 'A', 'Col2': 'B', 'Col3': 'C'} |
| Column 1 | Column 2 |
|---|---|
| A | B |
wrangles:
- split.dictionary:
input: Column
output:
- Col*: Column *
| Column |
|---|
| {'Col1': 'A', 'Col2': 'B', 'Col3': 'C'} |
| Column 1 | Column 2 | Column 3 |
|---|---|---|
| A | B | C |
Access
| Requirement | Value |
|---|---|
| AI-powered | No |
| Requires WrangleWorks account | No |
| Requires subscription | No |
| Requires external API key | No |
Technical details
| Field | Value |
|---|---|
| Catalog ID | 63 |
| Catalog key | split.dictionary |
| Recipe key | split.dictionary |
| Catalog status | active |
| Lifecycle status | active |
| Recipe Writer eligible | Yes |
| Namespace | split |
| Documentation group | split |
| Aliases | None |
| Runtime symbol | wrangles.recipe_wrangles.split.dictionary |
| Legacy UUID | 06ca98e4-d026-43f7-84eb-af246d401ba9 |
Sources