Skip to content

Cannot rename ColumnGroup and its children at the same time #405

@Jolanrensen

Description

@Jolanrensen

As the title says, renaming of columns inside column groups cannot be done if the column group itself is renamed in the same call.

For instance:

val myDf = dataFrameOf("a", "b", "c")(1, 2, 3).group("a", "b", "c").into("letters") //⌌---------------------⌍ //| | letters| //|--|------------------| //| 0| { a:1, b:2, c:3 }| //⌎---------------------⌏ myDf.rename { all().recursively() // or using the old notation allDfs(includeGroups = true) }.into { it.name + "_renamed" } //⌌---------------------⌍ //| | letters_renamed| //|--|------------------| //| 0| { a:1, b:2, c:3 }| //⌎---------------------⌏

It needs to be done in two separate operations, like:

myDf .rename { cols { !it.isColumnGroup() }.recursively() }.into { it.name + "_renamed" } .rename { cols { it.isColumnGroup() }.recursively() }.into { it.name + "_renamed" } //⌌--------------------------------------------⌍ //| | letters_renamed| //|--|-----------------------------------------| //| 0| { a_renamed:1, b_renamed:2, c_renamed...| //⌎--------------------------------------------⌏

From a user-perspective, this makes little sense and we should probably find a way to fix this.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions