polars.Expr.abs#

Expr.abs() Expr[source]#

Compute absolute values.

Same as abs(expr).

Examples

>>> df = pl.DataFrame(
...     {
...         "A": [-1.0, 0.0, 1.0, 2.0],
...     }
... )
>>> df.select(pl.col("A").abs())
shape: (4, 1)
┌─────┐
│ A   │
│ --- │
│ f64 │
╞═════╡
│ 1.0 │
├╌╌╌╌╌┤
│ 0.0 │
├╌╌╌╌╌┤
│ 1.0 │
├╌╌╌╌╌┤
│ 2.0 │
└─────┘