explode

Edit pageLast modified: 20 May 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 df = dataFrameOf("a", "b")(
    1, listOf(1, 2),
    2, listOf(3, 4),
)

df.explode("b")

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

Explode DataColumn<Collection>:

Explode FrameColumn: