min

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

Returns the minimum of the values in this DataColumn.

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.

Throws a NoSuchElementException 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:

  • minOrNull — returns null instead of throwing for a column with nothing to compare.

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

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

  • max — 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 age in the "age" column
df.age.min()
// The smallest weight in the "weight" column, ignoring `null` values
df.weight.min()

Return

The smallest value in this column.

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.

Throws

if there are no values to compare.


fun <T> DataFrame<T>.min(skipNaN: Boolean = skipNaNDefault): DataRow<T>

Returns the minimum of the values of each suitable column of this DataFrame separately.

All columns whose values are mutually comparable are taken into account; the other columns are simply left out of the result.

Columns inside column groups are also excluded. To include those in the minimum, flatten the DataFrame first.

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.

Result cells for which there is nothing left to compare (for instance, because the input was empty or contained only null values) simply become null.

For more information about the resulting types: See "min / max Type Conversion" on the documentation website.

See also:

  • minFor — the same, but for an explicit selection of columns.

  • min{ columns } — a single minimum of all values in the selected columns.

  • max — the mirror operation.

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

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

Example

// A single row with the smallest value of each comparable column
// ("name"/"firstName", "name"/"lastName", "age", "city", "weight", and "isHappy")
df.flatten().min()

Return

A single DataRow with the minimum of each suitable column of this DataFrame.

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>.min(skipNaN: Boolean = skipNaNDefault, columns: ColumnsSelector<T, C>): C & Any

Returns a single minimum of all the values in the selected columns of this DataFrame.

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.

Throws a NoSuchElementException 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:

  • minOrNull — returns null instead of throwing when there's nothing to compare.

  • minFor — the minimum of each selected column separately.

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

  • max — 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.min{ length andage }

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

df.min{ colsOf<Double>() }

Example

// The smallest of all values in the "age" and "weight" columns
df.min { age and weight }

Return

The smallest value among all the values in the selected columns.

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.

Throws

if there are no values to compare.


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

Returns a single minimum of all the values in the selected columns of this DataFrame.

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.

Throws a NoSuchElementException 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:

  • minOrNull — returns null instead of throwing when there's nothing to compare.

  • minFor — the minimum of each selected column separately.

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

  • max — 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.min("length", "age")

Example

// The smallest of all values in the "age" and "weight" columns
df.min("age", "weight")

Return

The smallest value among all the values in the selected columns.

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.

Throws

if there are no values to compare.


fun <T> Grouped<T>.min(skipNaN: Boolean = skipNaNDefault): DataFrame<T>

Aggregates this GroupBy by computing the minimum of the values of each suitable column separately, per group.

Returns a new DataFrame with one row per group, containing the group key columns and a column with the minimum for each suitable column. All columns whose values are mutually comparable are taken into account; the other columns are simply left out of the result.

Columns inside column groups are also excluded. To include those in the minimum, flatten the DataFrame first.

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.

Result cells for which there is nothing left to compare (for instance, because the input was empty or contained only null values) simply become null.

For more information about the resulting types: See "min / max Type Conversion" on the documentation website.

See also:

  • minFor — the same, but for an explicit selection of columns.

  • min{ columns } — a single minimum of all values in the selected columns, per group.

  • max — the mirror operation.

  • aggregate — the general way to aggregate groups.

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

For more information: See "groupBy statistics" on the documentation website., and See "GroupBy Aggregation Statistics" on the documentation website.

Example

// For each city, the smallest value of each comparable column
df.groupBy { city }.min()

Return

A new DataFrame with the group keys and the minimum of each suitable column per group.

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>?> Grouped<T>.min(name: String? = null, skipNaN: Boolean = skipNaNDefault, columns: ColumnsSelector<T, C?>): DataFrame<T>

Aggregates this GroupBy by computing a single minimum of all the values in the selected columns, per group.

Returns a new DataFrame with one row per group, containing the group key columns and a single column with the minimum per group. That column is named name, or, if name is null, after the selected column if exactly one column is selected, and "min" otherwise.

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.

Result cells for which there is nothing left to compare (for instance, because the input was empty or contained only null values) simply become null.

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 Selecting Columns.

See also:

  • minFor — the minimum of each selected column separately, per group.

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

  • max — the mirror operation.

  • aggregate — the general way to aggregate groups.

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

For more information: See "groupBy statistics" on the documentation website., and See "GroupBy Aggregation Statistics" on the documentation website.

Example

// For each city, the smallest of all values in the "age" and "weight" columns,
// in a column called "minValue"
df.groupBy { city }.min("minValue") { age and weight }

Return

A new DataFrame with the group keys and a single minimum per group.

Parameters

name

The name of the resulting column. If null (the default), the name of the selected column is used if exactly one column is selected, and "min" otherwise. This name needs to be unique, else a DuplicateColumnPathInsertException 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.

columns

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


fun <T> Grouped<T>.min(vararg columns: String, name: String? = null, skipNaN: Boolean = skipNaNDefault): DataFrame<T>

Aggregates this GroupBy by computing a single minimum of all the values in the selected columns, per group.

Returns a new DataFrame with one row per group, containing the group key columns and a single column with the minimum per group. That column is named name, or, if name is null, after the selected column if exactly one column is selected, and "min" otherwise.

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.

Result cells for which there is nothing left to compare (for instance, because the input was empty or contained only null values) simply become null.

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 Selecting Columns.

See also:

  • minFor — the minimum of each selected column separately, per group.

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

  • max — the mirror operation.

  • aggregate — the general way to aggregate groups.

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

For more information: See "groupBy statistics" on the documentation website., and See "GroupBy Aggregation Statistics" on the documentation website.

Example

// For each city, the smallest of all values in the "age" and "weight" columns,
// in a column called "minValue"
df.groupBy { city }.min("age", "weight", name = "minValue")

Return

A new DataFrame with the group keys and a single minimum per group.

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.

name

The name of the resulting column. If null (the default), the name of the selected column is used if exactly one column is selected, and "min" otherwise. This name needs to be unique, else a DuplicateColumnPathInsertException 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> Pivot<T>.min(separate: Boolean = false, skipNaN: Boolean = skipNaNDefault): DataRow<T>

Aggregates this Pivot by computing the minimum of the values of each suitable column separately, per group.

Returns a single DataRow with the pivot keys as (nested) columns, containing the minimum of each suitable column of the corresponding group. All columns whose values are mutually comparable are taken into account; the other columns are simply left out of the result.

Columns inside column groups are also excluded. To include those in the minimum, flatten the DataFrame first.

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.

Result cells for which there is nothing left to compare (for instance, because the input was empty or contained only null values) simply become null.

For more information about the resulting types: See "min / max Type Conversion" on the documentation website.

Check out the Pivot Grammar.

See also:

  • minFor — the same, but for an explicit selection of columns.

  • min{ columns } — a single minimum of all values in the selected columns, per group.

  • max — the mirror operation.

  • Pivot aggregation — all other ways to aggregate a Pivot.

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

For more information: See "pivot statistics" on the documentation website., and See "Pivot Aggregation statistics" on the documentation website.

Example

// For each city, the smallest value of each comparable column
df.pivot { city }.min()

Return

A single DataRow with the minimum of each suitable column per pivot group.

Parameters

separate

If false (the default), the resulting columns are indexed first by the pivot key(s) and then by the names of the aggregated columns. If true, this order is reversed: the results are grouped by aggregated column first.

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, R : Comparable<R & Any>?> Pivot<T>.min(skipNaN: Boolean = skipNaNDefault, columns: ColumnsSelector<T, R>): DataRow<T>

Aggregates this Pivot by computing a single minimum of all the values in the selected columns, per group.

Returns a single DataRow with the pivot keys as (nested) columns, containing the smallest value among all the values in the selected columns of the corresponding group.

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.

Result cells for which there is nothing left to compare (for instance, because the input was empty or contained only null values) simply become null.

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 Selecting Columns, or check out the Pivot Grammar.

See also:

  • min() — the minimum of each suitable column separately, per group.

  • minFor — the minimum of each selected column separately, per group.

  • max — the mirror operation.

  • Pivot aggregation — all other ways to aggregate a Pivot.

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

For more information: See "pivot statistics" on the documentation website., and See "Pivot Aggregation statistics" on the documentation website.

Example

// For each city, the smallest of all values in the "age" and "weight" columns
df.pivot { city }.min { age and weight }

Return

A single DataRow with, per pivot group, the smallest value among all the values in the selected columns.

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> Pivot<T>.min(vararg columns: String, skipNaN: Boolean = skipNaNDefault): DataRow<T>

Aggregates this Pivot by computing a single minimum of all the values in the selected columns, per group.

Returns a single DataRow with the pivot keys as (nested) columns, containing the smallest value among all the values in the selected columns of the corresponding group.

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.

Result cells for which there is nothing left to compare (for instance, because the input was empty or contained only null values) simply become null.

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 Selecting Columns, or check out the Pivot Grammar.

See also:

  • min() — the minimum of each suitable column separately, per group.

  • minFor — the minimum of each selected column separately, per group.

  • max — the mirror operation.

  • Pivot aggregation — all other ways to aggregate a Pivot.

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

For more information: See "pivot statistics" on the documentation website., and See "Pivot Aggregation statistics" on the documentation website.

Example

// For each city, the smallest of all values in the "age" and "weight" columns
df.pivot { city }.min("age", "weight")

Return

A single DataRow with, per pivot group, the smallest value among all the values in the selected columns.

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> PivotGroupBy<T>.min(separate: Boolean = false, skipNaN: Boolean = skipNaNDefault): DataFrame<T>

Aggregates this PivotGroupBy by computing the minimum of the values of each suitable column separately, per group.

Returns a DataFrame where each cell contains the minimum of each suitable column of the group corresponding to that pivot key (column) and groupBy key (row). All columns whose values are mutually comparable are taken into account; the other columns are simply left out of the result.

Columns inside column groups are also excluded. To include those in the minimum, flatten the DataFrame first.

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.

Result cells for which there exists a group, but there is nothing left to compare (for instance, because the group was empty or contained only null values) simply become null.

For more information about the resulting types: See "min / max Type Conversion" on the documentation website.

For empty pivot intersections, null or the set default is used.

Check out the PivotGroupBy Grammar.

See also:

For more information: See "pivot statistics" on the documentation website., and See "Pivot Aggregation statistics" on the documentation website.

Example

// Per city and last name, the smallest value of each comparable column
df.pivot { city }.groupBy { name.lastName }.min()

Return

A DataFrame with the minimum of each suitable column per group.

Parameters

separate

If false (the default), the resulting columns are indexed first by the pivot key(s) and then by the names of the aggregated columns. If true, this order is reversed: the results are grouped by aggregated column first.

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, R : Comparable<R & Any>?> PivotGroupBy<T>.min(skipNaN: Boolean = skipNaNDefault, columns: ColumnsSelector<T, R>): DataFrame<T>

Aggregates this PivotGroupBy by computing a single minimum of all the values in the selected columns, per group.

Returns a DataFrame where each cell contains the smallest value among all the values in the selected columns of the group corresponding to that pivot key (column) and groupBy key (row).

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.

Result cells for which there exists a group, but there is nothing left to compare (for instance, because the group was empty or contained only null values) simply become null.

For more information about the resulting types: See "min / max Type Conversion" on the documentation website.

For empty pivot intersections, null or the set default is used.

This can include column groups and nested columns.

See Selecting Columns, or check out the PivotGroupBy Grammar.

See also:

For more information: See "pivot statistics" on the documentation website., and See "Pivot Aggregation statistics" on the documentation website.

Example

// Per city and last name, the smallest of all values in the "age" and "weight" columns
df.pivot { city }.groupBy { name.lastName }.min { age and weight }

Return

A DataFrame with, per group, the smallest value among all the values in the selected columns.

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> PivotGroupBy<T>.min(vararg columns: String, skipNaN: Boolean = skipNaNDefault): DataFrame<T>

Aggregates this PivotGroupBy by computing a single minimum of all the values in the selected columns, per group.

Returns a DataFrame where each cell contains the smallest value among all the values in the selected columns of the group corresponding to that pivot key (column) and groupBy key (row).

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.

Result cells for which there exists a group, but there is nothing left to compare (for instance, because the group was empty or contained only null values) simply become null.

For more information about the resulting types: See "min / max Type Conversion" on the documentation website.

For empty pivot intersections, null or the set default is used.

This can include column groups and nested columns.

See Selecting Columns, or check out the PivotGroupBy Grammar.

See also:

For more information: See "pivot statistics" on the documentation website., and See "Pivot Aggregation statistics" on the documentation website.

Example

// Per city and last name, the smallest of all values in the "age" and "weight" columns
df.pivot { city }.groupBy { name.lastName }.min("age", "weight")

Return

A DataFrame with, per group, the smallest value among all the values in the selected columns.

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.


@get:JvmName(name = "ColumnDescription_min")
val ColumnsScope<ColumnDescription>.min: DataColumn<Any>
@get:JvmName(name = "ColumnDescription_min")
val DataRow<ColumnDescription>.min: Any
@get:JvmName(name = "NullableColumnDescription_min")
val ColumnsScope<ColumnDescription?>.min: DataColumn<Any?>
@get:JvmName(name = "NullableColumnDescription_min")
val DataRow<ColumnDescription?>.min: Any?


fun <T, C : Comparable<C & Any>?> DataFrame<T>.min(vararg columns: ColumnReference<C>, skipNaN: Boolean = skipNaNDefault): C & Any
fun <T, C : Comparable<C & Any>?> DataFrame<T>.min(vararg columns: KProperty<C>, skipNaN: Boolean = skipNaNDefault): C & Any
fun <T, C : Comparable<C & Any>?> Grouped<T>.min(vararg columns: ColumnReference<C>, name: String? = null, skipNaN: Boolean = skipNaNDefault): DataFrame<T>
fun <T, C : Comparable<C & Any>?> Grouped<T>.min(vararg columns: KProperty<C>, name: String? = null, skipNaN: Boolean = skipNaNDefault): DataFrame<T>
fun <T, R : Comparable<R & Any>?> Pivot<T>.min(vararg columns: ColumnReference<R>, skipNaN: Boolean = skipNaNDefault): DataRow<T>
fun <T, R : Comparable<R & Any>?> Pivot<T>.min(vararg columns: KProperty<R>, skipNaN: Boolean = skipNaNDefault): DataRow<T>
fun <T, R : Comparable<R & Any>?> PivotGroupBy<T>.min(vararg columns: ColumnReference<R>, skipNaN: Boolean = skipNaNDefault): DataFrame<T>
fun <T, R : Comparable<R & Any>?> PivotGroupBy<T>.min(vararg columns: KProperty<R>, skipNaN: Boolean = skipNaNDefault): DataFrame<T>

Deprecated

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