perCol

fun <T, C> Update<T, C>.perCol(values: Map<String, C>): DataFrame<T>

Per Col

Per Col can be used for two different types of operations:

For more information: See update on the documentation website.

See Also

  • Update with to provide a new value for every selected cell giving its row and its previous value.

  • Update per row col to provide a new value for every selected cell giving its row and column.

This Per Col Overload

Provide a new value for every selected cell per column using a Map<colName: String, value: C> or DataRow as Map.

For example:

val defaults = mapOf("name" to "Empty", "age" to 0)

df.update{ name and age }.where{ ... }.perCol(defaults)

Parameters

values

The Map<String, Value> to provide a new value for every selected cell. For each selected column, there must be a value in the map with the same name.

Throws

if a value for a selected cell's column is not defined in values.


fun <T, C> Update<T, C>.perCol(values: DataRow<*>): DataFrame<T>

Per Col

Per Col can be used for two different types of operations:

For more information: See update on the documentation website.

See Also

  • Update with to provide a new value for every selected cell giving its row and its previous value.

  • Update per row col to provide a new value for every selected cell giving its row and column.

This Per Col Overload

Provide a new value for every selected cell per column using a Map<colName: String, value: C> or DataRow as Map.

For example:

val defaults = df.getRows(listOf(0))

    .update{ name }.with{ "Empty" }

    .update{ age }.with{ 0 }

    .first()

df.update{ name and age }.where{ ... }.perCol(defaults)

Parameters

values

The DataRow to provide a new value for every selected cell.

Throws

if a value for a selected cell's column is not defined in values.


fun <T, C> Update<T, C>.perCol(valueSelector: ColumnExpression<C, C>): DataFrame<T>

Per Col

Per Col can be used for two different types of operations:

For more information: See update on the documentation website.

See Also

  • Update with to provide a new value for every selected cell giving its row and its previous value.

  • Update per row col to provide a new value for every selected cell giving its row and column.

This Per Col Overload

Provide a new value for every selected cell given its column using a column expression.

For example:

df.update{ age }.perCol{ mean(skipNA = true) }

df.update{ age }.perCol{ count{ it > 10 } }

Parameters

valueSelector

The org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenColumn.ColumnExpression to provide a new value for every selected cell giving its column.