Skip to content

Add examples for rename #952

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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