polars.min#
- polars.min(exprs: Series) PythonLiteral | None [source]#
- polars.min(exprs: IntoExpr | Iterable[IntoExpr], *more_exprs: IntoExpr) Expr
Get the minimum value.
If a single string is passed, this is an alias for
pl.col(name).min()
.If a single Series is passed, this is an alias for
Series.min()
. This functionality is deprecated.Otherwise, this function computes the minimum value horizontally across multiple columns. This functionality is deprecated, use
pl.min_horizontal
instead.- Parameters:
- exprs
Column(s) to use in the aggregation. Accepts expression input. Strings are parsed as column names, other non-expression inputs are parsed as literals.
- *more_exprs
Additional columns to use in the aggregation, specified as positional arguments.
See also
Examples
Get the minimum value of a column by passing a single column name.
>>> df = pl.DataFrame( ... { ... "a": [1, 8, 3], ... "b": [4, 5, 2], ... "c": ["foo", "bar", "foo"], ... } ... ) >>> df.select(pl.min("a")) shape: (1, 1) ┌─────┐ │ a │ │ --- │ │ i64 │ ╞═════╡ │ 1 │ └─────┘
Get column-wise minimums for multiple columns by passing a regular expression, or call
.min()
on a multi-column expression instead.>>> df.select(pl.min("^a|b$")) shape: (1, 2) ┌─────┬─────┐ │ a ┆ b │ │ --- ┆ --- │ │ i64 ┆ i64 │ ╞═════╪═════╡ │ 1 ┆ 2 │ └─────┴─────┘ >>> df.select(pl.col("a", "b").min()) shape: (1, 2) ┌─────┬─────┐ │ a ┆ b │ │ --- ┆ --- │ │ i64 ┆ i64 │ ╞═════╪═════╡ │ 1 ┆ 2 │ └─────┴─────┘