Nest: Merge fields into a string record using a layout¶
- class txf.Nest(source, inputs, output[, layout='csv'[, **config]])¶
The
Nest
transform combines fields into a single string field using a particular layout.Nest
is the logical inverse ofUnnest
. It is a subclass ofMerge
.- inputs: tuple(str) or str¶
The fields to combine. They will be dropped from the output, so use
Copy
to preserve them.
- output: str¶
The output field receiving the merged values. It cannot overwrite existing fields. Use
Drop
to remove unwanted fields.
- layout: str¶
The layout to generate the output in. Supported layouts are:
csv
Comma-separated stringjson
,jsonl
JavaScript Object Notation stringmd
GitHub Markdown rowtext
The Python string representation of the inputs as a list
- config: kwargs¶
Extra arguments to be passed to the layout object.
Usage¶
Nest(p, ('F1', 'F2',) 'CSV', 'csv')
Nest(p, ('Sales 1992', 'Sales 1993',) 'Dict', 'py')