perRowCol
Converts values in the columns previously selected with convert using row column expression within the DataFrame.
A row column expression allows you to provide a new value for every selected cell given its row and column (as lambda arguments).
For more information: See convert on the documentation website.
See Also
Convert withto provide a new value for every selected cell giving its row and its previous value.Convert as columnto convert using a column converter
Example:
// Convert values in all columns to `String` and add their column name to the end
df.convert { all() }.perRowCol { row, col ->
col[row].toString() + col.name()
}Parameters
Infer strategy that defines how the type of the resulting column should be determined. Defaults to Infer.Nulls.
The RowColumnExpression to provide a new value for every selected cell giving its row and column.
Creates a new FormattedFrame that uses the specified RowColFormatter to format the selected cells of the dataframe.
You need to specify formatter: A lambda function expecting a CellAttributes or null given an instance of DataRow<T> and ColumnWithPath<C>.
This is similar to a RowColumnExpression, except that you also have access to the FormattingDsl in the context.
The formatting DSL allows you to create and combine CellAttributes to apply to one or multiple cells of a dataframe such that they have specific CSS attributes applied to them when rendered to HTML.
For instance, to specify black, bold text on a white background, you could write:
background(white) and textColor(black) and bold
It's also possible to define your own colors using rgb or interpolate colors using linear.
Use attr if you want to specify a custom CSS attribute.
For more information: See format on the documentation website.
Examples using perRowCol:
df.format { colsOf<Int>() }.perRowCol { row, col ->
linearBg(col[row], col.min() to red, col.max() to green)
}Check out the full Grammar.
Per Row Col
Provide a new value for every selected cell given both its row and column using a row-column expression.
For example:
df.update{ age }.perRowCol{ row, col ->
row.age / col.mean(skipNA = true)
}
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 colto provide a new value for every selected cell giving its column.
Parameters
The Row Column Expression to provide a new value for every selected cell giving its row and column.