Dataframe
 
0.15

explode

Edit page Last modified: 14 January 2025

Splits list-like values in given columns and spreads them vertically. Values in other columns are duplicated.

Parameters:

  • dropEmpty — if true, removes rows with empty lists or DataFrame objects. Otherwise, they will be exploded into null.

Available for:

Reverse operation: implode

Exploded columns will change their types:

Exploded FrameColumn will be converted into ColumnGroup.

Explode DataFrame:

val a by columnOf(1, 2)
val b by columnOf(listOf(1, 2), listOf(3, 4))

val df = dataFrameOf(a, b)

df.explode { b }

When several columns are exploded in one operation, lists in different columns will be aligned.

Explode DataColumn<Collection>:

Explode FrameColumn: