Dataframe 0.14 Help

explode

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

explode(dropEmpty = true) [ { columns } ]

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 }
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.

val a by columnOf(listOf(1, 2), listOf(3, 4, 5)) val b by columnOf(listOf(1, 2, 3), listOf(4, 5)) val df = dataFrameOf(a, b) df.explode { a and b }

Explode DataColumn<Collection>:

val col by columnOf(listOf(1, 2), listOf(3, 4)) col.explode()

Explode FrameColumn:

val col by columnOf( dataFrameOf("a", "b")(1, 2, 3, 4), dataFrameOf("a", "b")(5, 6, 7, 8), ) col.explode()
Last modified: 27 September 2024