Skip to content

Commit

Permalink
Add examples for rename
Browse files Browse the repository at this point in the history
  • Loading branch information
koperagen committed Nov 14, 2024
1 parent 3f054ab commit 10baf11
Show file tree
Hide file tree
Showing 4 changed files with 1,103 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1464,4 +1464,63 @@ class Modify : TestBase() {
}
// SampleEnd
}

@Test
@TransformDataFrameExpressions
fun rename_properties() {
// SampleStart
df.rename { name }.into("fullName")
// SampleEnd
}

@Test
@TransformDataFrameExpressions
fun rename_accessors() {
// SampleStart
val name by columnGroup()
df.rename { name }.into("fullName")
// SampleEnd
}

@Test
@TransformDataFrameExpressions
fun rename_strings() {
// SampleStart
df.rename("name").into("fullName")
// SampleEnd
}

@Test
@TransformDataFrameExpressions
fun renameExpression_properties() {
// SampleStart
df.rename { age }.into {
val mean = it.data.mean()
"age [mean = $mean]"
}
// SampleEnd
}

@Test
@TransformDataFrameExpressions
fun renameExpression_accessors() {
// SampleStart
val age by column<Int>()
df.rename { age }.into {
val mean = it.data.mean()
"age [mean = $mean]"
}
// SampleEnd
}

@Test
@TransformDataFrameExpressions
fun renameExpression_strings() {
// SampleStart
df.rename("age").into {
val mean = it.data.cast<Int>().mean()
"age [mean = $mean]"
}
// SampleEnd
}
}
Loading

0 comments on commit 10baf11

Please sign in to comment.