notNull
Filters the format-selection to only include cells where the value is not null.
This is shorthand for .where{ it != null }.
For more information: See format on the documentation website.
Examples using notNull:
df.format { colsOf<Int?>() }.notNull().perRowCol { row, col ->
linearBg(col[row], col.min() to red, col.max() to green)
}Creates a new FormattedFrame that uses the specified CellFormatter to format selected non-null cells of the dataframe.
This function is shorthand for .notNull().with { }.
You need to specify formatter: A lambda function expecting a CellAttributes or null given an instance of a cell: C of the dataframe.
You 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 notNull:
df.format().notNull { bold and textColor(black) }Check out the full Grammar.
Filters out null values from the columns previously selected by gather, keeping only non-null entries.
A special case of Gather.where.
It's an intermediate step; returns a new Gather with filtered value columns.
For more information: See gather on the documentation website.
See Grammar.
Example
// Gather `resultA` and `resultB` columns into a single "value" column,
// with the "series" column containing a key.
// Assuming these columns contain nullable `Double` values, `notNull` filters out nulls,
// allowing subsequent transformations like `mapValues` to treat values as non-null `Double`.
df.gather { resultA and resultB }
.notNull()
.mapValues { (it + 0.5).toFloat() }
.into("series", "value")Return
A new Gather instance with only non-null values retained.
Not Null
Filters the update-selection to only include cells where the value is not null.
This is shorthand for .where{ it != null }.
For example:
df.update{ colsOf<Int?>() }.notNull().perRowCol{ row, col ->
row[col] / col.mean(skipNA = true)
}
For more information: See update on the documentation website.
Not Null
Selects only the rows where the values in the selected columns are not null.
Shorthand for: update{ ... }.where{ it != null }
For example:
df.update{ colsOf<Number?>() }.notNull().perCol{ mean() }
Optional
Provide an expression to update the rows with. This combines with with notNull.
For example:
df.update{ city }.notNull{ it.toUpperCase() }
For more information: See update on the documentation website.
Parameters
Optional Row Expression to update the rows with.