after

Inserts the new column previously specified with insert at the position immediately after the selected column (on the same level).

For more information: See insert on the documentation website.

See Grammar for more details.

See Column Selection DSL.

Examples:

// Insert a new column "age" after the "name" column
df.insert(age).after { name }

// Insert a new column "sum" after the nested "min" column (inside the "stats" column group)
val dfWithSum = df.insert("sum") { a + b }.after { stats.min }

Return

A new DataFrame with the inserted column placed after the selected column.

Parameters

column

The ColumnSelector used to choose an existing column in this DataFrame, after which the new column will be inserted.


fun <T> InsertClause<T>.after(column: String): DataFrame<T>

Inserts the new column previously specified with insert at the position immediately after the column with the given name.

For more information: See insert on the documentation website.

See Grammar for more details.

See also: SelectingColumns.ColumnNamesApi.

Example

// Insert a new column "age" after the "name" column
df.insert(age).after("name")

Return

A new DataFrame with the inserted column placed after the specified column.

Parameters

column

The String name of the column in this DataFrame after which the new column will be inserted.


fun <T, C> MoveClause<T, C>.after(column: ColumnSelector<T, *>): DataFrame<T>

Moves columns, previously selected with move to the position after the specified column within the DataFrame.

Returns a new DataFrame with updated columns.

See Selecting Columns.

For more information: See move on the documentation website.

This After Overload

Select or express columns using the Columns Selection DSL.

This DSL is initiated by a Columns Selector lambda, which operates in the context of the Columns Selection DSL and expects you to return a SingleColumn or ColumnSet (so, a ColumnsResolver). This is an entity formed by calling any (combination) of the functions in the DSL that is or can be resolved into one or more columns.

The Columns Selection DSL allows using Extension Properties for specifying columns type- and name-safe.

Check out: Columns Selection DSL Grammar

    

See Column Selectors on the documentation website.

Examples:

df.move { age and weight }.after { surname }
df.move { cols(0..2) }.after { col(3) }

Parameters

column

A ColumnSelector specifying the column after which the selected columns will be placed.


fun <T, C> MoveClause<T, C>.after(column: String): DataFrame<T>

Moves columns, previously selected with move to the position after the specified column within the DataFrame.

Returns a new DataFrame with updated columns.

See Selecting Columns.

For more information: See move on the documentation website.

This After Overload

Select single or multiple columns using their names as Strings. (String API).

Examples:

df.move("age", "weight").after("surname")

Parameters

column

The Column Name specifying the column after which the selected columns will be placed.


fun <T> InsertClause<T>.after(column: KProperty<*>): DataFrame<T>
fun <T, C> MoveClause<T, C>.after(column: ColumnReference<*>): DataFrame<T>
fun <T, C> MoveClause<T, C>.after(column: KProperty<*>): DataFrame<T>

Deprecated

It's recommended to migrate to the String or Extension Properties Access API https://kotlin.github.io/dataframe/apilevels.html


fun <T> InsertClause<T>.after(columnPath: ColumnPath): DataFrame<T>

Deprecated (with error)

This `after()` overload will be removed in favor of `after { }` with Column Selection DSL. Will be ERROR in 1.0.

Replace with

this.after { columnPath }