maxOrNull
Returns the maximum of the values in this DataColumn, or null if there is nothing to compare.
Only self-comparable values are supported: values of a type T : Comparable<T> that are mutually comparable (like strings, primitive numbers, or dates). This includes all primitive number types, but no mix of different number types, which would result in a ClassCastException.
null values in the input are always ignored.
If the input contains values, the result will be NaNNaN, unless skipNaN is set to true.
Returns null when there is nothing left to compare, for instance when the input is empty or contains only null (or, if skipNaN is true, only null and ) values.NaN
The result has the same type as the input values (minus nullability, if the input values were nullable).
For more information about the resulting types: See "min / max Type Conversion" on the documentation website.
See also:
max— throws instead of returningnullfor a column with nothing to compare.maxOfOrNull— the maximum of the values a selector returns for each element.maxByOrNull— the element for which a selector returns the maximum value.minOrNull— the mirror operation.The Max Operation— an overview of allmaxmodes.
For more information: See "min / max" on the documentation website.
Example
// The largest weight in the "weight" column,
// or `null` if the column contains no values other than `null`
df.weight.maxOrNull()Return
The largest value in this column, or null if there are no values to compare.
Parameters
Returns a single maximum of all the values in the selected columns of this DataFrame, or null if there is nothing to compare.
Only self-comparable values are supported: values of a type T : Comparable<T> that are mutually comparable (like strings, primitive numbers, or dates). This includes all primitive number types, but no mix of different number types, which would result in a ClassCastException.
null values in the input are always ignored.
If the input contains values, the result will be NaNNaN, unless skipNaN is set to true.
Returns null when there is nothing left to compare, for instance when the input is empty or contains only null (or, if skipNaN is true, only null and ) values.NaN
The result has the same type as the input values (minus nullability, if the input values were nullable).
For more information about the resulting types: See "min / max Type Conversion" on the documentation website.
This can include column groups and nested columns.
See also:
max— throws instead of returningnullwhen there's nothing to compare.maxFor— the maximum of each selected column separately.maxOfOrNull— the maximum of the values a row expression returns for each row.minOrNull— the mirror operation.The Max Operation— an overview of allmaxmodes.
For more information: See "min / max" on the documentation website.
Select or express columns using the Columns Selection DSL.
This DSL is initiated by a Columns Selector lambda, which operates in the context of the Columns Selection DSL and expects you to return a SingleColumn or ColumnSet (so, a ColumnsResolver). This is an entity formed by calling any (combination) of the functions in the DSL that is or can be resolved into one or more columns.
The Columns Selection DSL allows using Extension Properties for specifying columns type- and name-safe.
Check out: Columns Selection DSL Grammar
See Column Selectors on the documentation website.
For example:
df.maxOrNull{ colsOf<Double>() }
Example
// The largest of all values in the "age" and "weight" columns,
// or `null` if there are no values to compare
df.maxOrNull { age and weight }Return
The largest value among all the values in the selected columns, or null if there are no values to compare.
Parameters
The ColumnsSelector used to select the columns to compute the maximum of.
Returns a single maximum of all the values in the selected columns of this DataFrame, or null if there is nothing to compare.
Only self-comparable values are supported: values of a type T : Comparable<T> that are mutually comparable (like strings, primitive numbers, or dates). This includes all primitive number types, but no mix of different number types, which would result in a ClassCastException.
null values in the input are always ignored.
If the input contains values, the result will be NaNNaN, unless skipNaN is set to true.
Returns null when there is nothing left to compare, for instance when the input is empty or contains only null (or, if skipNaN is true, only null and ) values.NaN
The result has the same type as the input values (minus nullability, if the input values were nullable).
For more information about the resulting types: See "min / max Type Conversion" on the documentation website.
This can include column groups and nested columns.
See also:
max— throws instead of returningnullwhen there's nothing to compare.maxFor— the maximum of each selected column separately.maxOfOrNull— the maximum of the values a row expression returns for each row.minOrNull— the mirror operation.The Max Operation— an overview of allmaxmodes.
For more information: See "min / max" on the documentation website.
Select single or multiple columns using their names as Strings. (String API).
For example:
df.maxOrNull("length", "age")
Example
// The largest of all values in the "age" and "weight" columns,
// or `null` if there are no values to compare
df.maxOrNull("age", "weight")Return
The largest value among all the values in the selected columns, or null if there are no values to compare.
Parameters
The names of the columns to compute the maximum of. The values in these columns must be mutually comparable, else an IllegalStateException is thrown.
Deprecated
It's recommended to migrate to the String or Extension Properties Access API https://kotlin.github.io/dataframe/apilevels.html