Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space DEV and version next

...

Example - Flatten an array

In this example, the source data includes an array of scores that need to broken out into separate rows.

Source:

...

Transformation:

When the data is imported, you might have to re-type the Scores column as an array:

D trans
RawWrangletrue
Typestep
WrangleTextsettype col: Scores type: 'Array'
p01NameColumns
p01ValueScores
p02NameNew type
p02ValueArray
SearchTermChange column data type

You can now flatten the Scores column data into separate rows:

D trans
RawWrangletrue
Typestep
WrangleTextflatten col: Scores
p01NameColumn
p01ValueScores
SearchTermExpand Array into rows

Results:

...

This example is extended below.

Include Page
EXAMPLE - Flatten an Array
EXAMPLE - Flatten an Array

Example - Flatten and unnest together

...