Skip to main content

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​

NameDescriptionAccepted ValuesDefaultRequired
I/O
inputName 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
outputIn 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, nullnullNo
Formatting
output_formatHow 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
  • to_lists
"columns"No
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
defaultProvide a set of default headings and values if they are not found within the input.object, nullnullNo

Examples​

wrangles:
- split.dictionary:
input: Column
# Output not required
Column
{'Col1': 'A', 'Col2': 'B', 'Col3': 'C'}
Col1Col2Col3
ABC
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'}
Col1Col2
AB
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 1Column 2
AB
wrangles:
- split.dictionary:
input: Column
output:
- Col*: Column *
Column
{'Col1': 'A', 'Col2': 'B', 'Col3': 'C'}
Column 1Column 2Column 3
ABC
Access
RequirementValue
AI-poweredNo
Requires WrangleWorks accountNo
Requires subscriptionNo
Requires external API keyNo
Technical details
FieldValue
Catalog ID63
Catalog keysplit.dictionary
Recipe keysplit.dictionary
Catalog statusactive
Lifecycle statusactive
Recipe Writer eligibleYes
Namespacesplit
Documentation groupsplit
AliasesNone
Runtime symbolwrangles.recipe_wrangles.split.dictionary
Legacy UUID06ca98e4-d026-43f7-84eb-af246d401ba9

Sources