minOrNull

fun <T : Comparable<T>> DataColumn<T?>.minOrNull(skipNaN: Boolean = skipNaNDefault): T?

Returns the minimum 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 NaN values, the result will be NaN, 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 NaN) values.

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:

  • min — throws instead of returning null for a column with nothing to compare.

  • minOfOrNull — the minimum of the values a selector returns for each element.

  • minByOrNull — the element for which a selector returns the minimum value.

  • maxOrNull — the mirror operation.

  • The Min Operation — an overview of all min modes.

For more information: See "min / max" on the documentation website.

Example

// The smallest weight in the "weight" column,
// or `null` if the column contains no values other than `null`
df.weight.minOrNull()

Return

The smallest value in this column, or null if there are no values to compare.

Parameters

skipNaN

If true, NaN values are ignored, just like null values. If false (the default), a NaN in the input is propagated to the result. This only has an effect on Double and Float values.


fun <T, C : Comparable<C & Any>?> DataFrame<T>.minOrNull(skipNaN: Boolean = skipNaNDefault, columns: ColumnsSelector<T, C>): C?

Returns a single minimum 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 NaN values, the result will be NaN, 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 NaN) values.

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:

  • min — throws instead of returning null when there's nothing to compare.

  • minFor — the minimum of each selected column separately.

  • minOfOrNull — the minimum of the values a row expression returns for each row.

  • maxOrNull — the mirror operation.

  • The Min Operation — an overview of all min modes.

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.minOrNull{ length andage }

df.minOrNull{ cols(1..5) }

df.minOrNull{ colsOf<Double>() }

Example

// The smallest of all values in the "age" and "weight" columns,
// or `null` if there are no values to compare
df.minOrNull { age and weight }

Return

The smallest value among all the values in the selected columns, or null if there are no values to compare.

Parameters

skipNaN

If true, NaN values are ignored, just like null values. If false (the default), a NaN in the input is propagated to the result. This only has an effect on Double and Float values.

columns

The ColumnsSelector used to select the columns to compute the minimum of.


fun <T> DataFrame<T>.minOrNull(vararg columns: String, skipNaN: Boolean = skipNaNDefault): Comparable<Any>?

Returns a single minimum 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 NaN values, the result will be NaN, 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 NaN) values.

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:

  • min — throws instead of returning null when there's nothing to compare.

  • minFor — the minimum of each selected column separately.

  • minOfOrNull — the minimum of the values a row expression returns for each row.

  • maxOrNull — the mirror operation.

  • The Min Operation — an overview of all min modes.

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.minOrNull("length", "age")

Example

// The smallest of all values in the "age" and "weight" columns,
// or `null` if there are no values to compare
df.minOrNull("age", "weight")

Return

The smallest value among all the values in the selected columns, or null if there are no values to compare.

Parameters

columns

The names of the columns to compute the minimum of. The values in these columns must be mutually comparable, else an IllegalStateException is thrown.

skipNaN

If true, NaN values are ignored, just like null values. If false (the default), a NaN in the input is propagated to the result. This only has an effect on Double and Float values.


fun <T, C : Comparable<C & Any>?> DataFrame<T>.minOrNull(vararg columns: ColumnReference<C>, skipNaN: Boolean = skipNaNDefault): C?
fun <T, C : Comparable<C & Any>?> DataFrame<T>.minOrNull(vararg columns: KProperty<C>, skipNaN: Boolean = skipNaNDefault): C?

Deprecated

It's recommended to migrate to the String or Extension Properties Access API https://kotlin.github.io/dataframe/apilevels.html