polars.min#

polars.min(*names: str) Expr[source]#

Get the minimum value.

Syntactic sugar for col(names).min().

Parameters:
*names

Name(s) of the columns to use in the aggregation.

See also

min_horizontal

Examples

Get the minimum value of a column.

>>> 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 the minimum value of multiple columns.

>>> df.select(pl.min("^a|b$"))
shape: (1, 2)
┌─────┬─────┐
│ a   ┆ b   │
│ --- ┆ --- │
│ i64 ┆ i64 │
╞═════╪═════╡
│ 1   ┆ 2   │
└─────┴─────┘
>>> df.select(pl.min("a", "b"))
shape: (1, 2)
┌─────┬─────┐
│ a   ┆ b   │
│ --- ┆ --- │
│ i64 ┆ i64 │
╞═════╪═════╡
│ 1   ┆ 2   │
└─────┴─────┘