polars math abs for dataframe
Compute the absolute values of a column expression.
Signature
> polars math abs {flags}
Input/output types:
| input | output |
|---|---|
| polars_expression | polars_expression |
| polars_selector | polars_expression |
Examples
Compute the absolute value of an integer column
> [[a]; [0] [-1] [2] [-3] [4]] |
polars into-df |
polars select (polars col a | polars math abs) |
polars collect
╭───┬───╮
│ # │ a │
├───┼───┤
│ 0 │ 0 │
│ 1 │ 1 │
│ 2 │ 2 │
│ 3 │ 3 │
│ 4 │ 4 │
╰───┴───╯