Dataframe 0.15 Help

move

Moves one or several columns within DataFrame.

move { columns } .into { pathSelector } | .under { parentColumn } | .after { column } | .to(position) | .toTop() | .toLeft() | .toRight() pathSelector: DataFrame.(DataColumn) -> ColumnPath

See Column Selectors

Can be used to change columns hierarchy by providing ColumnPath for every moved column

df.move { age }.toLeft() df.move { weight }.to(1) // age -> info.age // weight -> info.weight df.move { age and weight }.into { pathOf("info", it.name()) } df.move { age and weight }.into { "info"[it.name()] } df.move { age and weight }.under("info") // name.firstName -> fullName.first // name.lastName -> fullName.last df.move { name.firstName and name.lastName }.into { pathOf("fullName", it.name().dropLast(4)) } // a|b|c -> a.b.c // a|d|e -> a.d.e dataFrameOf("a|b|c", "a|d|e")(0, 0) .move { all() }.into { it.name().split("|").toPath() } // name.firstName -> firstName // name.lastName -> lastName df.move { name.cols() }.toTop() // a.b.e -> be // c.d.e -> de df.move { colsAtAnyDepth { it.name() == "e" } }.toTop { it.parentName + it.name() }

Special cases of move:

Last modified: 09 December 2024