Skip to content

Commit

Permalink
Merge pull request #952 from Kotlin/documentation-updates
Browse files Browse the repository at this point in the history
Add examples for rename
  • Loading branch information
koperagen authored Nov 20, 2024
2 parents f460bc4 + ead4f86 commit 111c0ff
Show file tree
Hide file tree
Showing 5 changed files with 1,114 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/src/main/resources/table.css
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ table.dataframe th {

table.dataframe td {
vertical-align: top;
white-space: nowrap;
}

table.dataframe th.bottomBorder {
Expand Down
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 111c0ff

Please sign in to comment.