Inserts new column at specific position in DataFrame.
insert (columnName) { rowExpression } | (column) .under { parentColumn } | .after { column } | .at(position) rowExpression: DataRow.(DataRow) -> Value
Similar to add, but supports column positioning.
Create new column based on existing columns and insert it into DataFrame:
Related operations: Insert / replace columns
df.insert("year of birth") { 2021 - age }.after { age }
df.insert("year of birth") { 2021 - "age"<Int>() }.after("age")
Insert previously created column:
val score by columnOf(4, 5, 3, 5, 4, 5, 3) df.insert(score).at(2)
10 March 2026