RenameClause

class RenameClause<T, C>(val df: DataFrame<T>, val columns: ColumnsSelector<T, C>)

An intermediate class used in the rename operation.

This class itself does not perform any renaming — it is a transitional step before specifying how to rename the selected columns. It must be followed by one of the renaming methods to produce a new DataFrame with renamed columns.

The resulting columns will keep their original values and positions in the DataFrame, but their names will be changed.

Use the following methods to perform the conversion:

  • to(name) — renames selected columns to the specified names.

  • to { nameExpression } — renames selected columns using a custom expression, which takes the column and its path and returns a new name.

  • toCamelCase() — renames all selected columns to camelCase.

For more information: See rename on the documentation website.

See Grammar for more details.

Constructors

Link copied to clipboard
constructor(df: DataFrame<T>, columns: ColumnsSelector<T, C>)

Properties

Link copied to clipboard
internal val columns: ColumnsSelector<T, C>
Link copied to clipboard
internal val df: DataFrame<T>

Functions

Link copied to clipboard
fun <T, C> RenameClause<T, C>.into(transform: (ColumnWithPath<C>) -> String): DataFrame<T>
fun <T, C> RenameClause<T, C>.into(vararg newNames: String): DataFrame<T>

NOTE: While you can keep using 'into', we recommend using to for better readability and more natural English.

fun <T, C> RenameClause<T, C>.into(vararg newNames: KProperty<*>): DataFrame<T>
fun <T, C> RenameClause<T, C>.into(vararg newColumns: ColumnReference<*>): DataFrame<T>
Link copied to clipboard
internal fun <T, C> RenameClause<T, C>.renameImpl(newNames: Array<out String>): DataFrame<T>
internal fun <T, C> RenameClause<T, C>.renameImpl(transform: (ColumnWithPath<C>) -> String): DataFrame<T>
Link copied to clipboard
fun to(transform: (ColumnWithPath<C>) -> String): DataFrame<T>

Renames the columns selected with rename by applying the transform expression to each of them. This expression receives the column together with its full path (as ColumnWithPath) and must return the new name for that column. The operation preserves the original columns’ values and their positions within the DataFrame.

fun to(vararg newNames: String): DataFrame<T>

Renames the columns selected with rename to the specified newNames, preserving their values and positions within the DataFrame.

Link copied to clipboard
fun <T, C> RenameClause<T, C>.to(transform: (ColumnWithPath<C>) -> String): DataFrame<T>

Renames the columns selected with rename by applying the transform expression to each of them. This expression receives the column together with its full path (as ColumnWithPath) and must return the new name for that column. The operation preserves the original columns’ values and their positions within the DataFrame.

fun <T, C> RenameClause<T, C>.to(vararg newNames: String): DataFrame<T>

Renames the columns selected with rename to the specified newNames, preserving their values and positions within the DataFrame.

Link copied to clipboard

Renames the columns, previously selected with rename to "camelCase" format.

Link copied to clipboard
open override fun toString(): String