perCol
Per Col
Per Col can be used for two different types of operations:
Provide a new value for every selected cell given its column using a
column expression.Provide a new value for every selected cell per column using a
Map<colName: String, value: C>orDataRowas Map.
For more information: See update on the documentation website.
See Also
Update withto provide a new value for every selected cell giving its row and its previous value.Update per row colto 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
Throws
if a value for a selected cell's column is not defined in values.
Per Col
Per Col can be used for two different types of operations:
Provide a new value for every selected cell given its column using a
column expression.Provide a new value for every selected cell per column using a
Map<colName: String, value: C>orDataRowas Map.
For more information: See update on the documentation website.
See Also
Update withto provide a new value for every selected cell giving its row and its previous value.Update per row colto 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" }
.first()
df.update{ name and age }.where{ ... }.perCol(defaults)
Parameters
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.
Per Col
Per Col can be used for two different types of operations:
Provide a new value for every selected cell given its column using a
column expression.Provide a new value for every selected cell per column using a
Map<colName: String, value: C>orDataRowas Map.
For more information: See update on the documentation website.
See Also
Update withto provide a new value for every selected cell giving its row and its previous value.Update per row colto 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
The org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenColumn.ColumnExpression to provide a new value for every selected cell giving its column.