split
This operation splits every value in the given columns into several values and optionally spreads them horizontally or vertically.
The following types of columns can be split easily:
String
: for instance, by","
List
: splits into elements, noby
required!DataFrame
: splits into rows, noby
required!
See column selectors for how to select the columns for this operation.
Split in place
Stores split values as lists in their original columns.
Use the .inplace()
terminal operation in your split
configuration to spread split values in place:
Split horizontally
Stores split values in new columns.
into(col1, col2, ... )
— stores split values in new top-level columnsinward(col1, col2, ...)
— stores split values in new columns nested inside the original columnintoColumns
— splitsFrameColumns
intoColumnGroups
storing in every cell in aList
of the original values per column
Reverse operation: merge
columnNamesGenerator
is used to generate names for additional columns when the list of explicitly specified columnNames
is not long enough. columnIndex
starts with 1
for the first additional column name.
The default columnNamesGenerator
generates column names like split1
, split2
, etc.
Some examples:
String
columns can also be split into group matches of Regex
patterns:
FrameColumn
can be split into columns:
Split vertically
Stores split values in new rows, duplicating values in other columns.
Reverse operation: implode
Use the .intoRows()
terminal operation in your split
configuration to spread split values vertically:
Equals to split { column }...inplace().explode { column }
. See explode
for details.