Get the sign of elements
Description
Get the sign of elements
Usage
<Expr>$sign()
Value
Expr
Examples
library("polars")
pl$DataFrame(a = c(.9, -3, -0, 0, 4, NA_real_))$
with_columns(sign = pl$col("a")$sign())
#> shape: (6, 2)
#> ┌──────┬──────┐
#> │ a ┆ sign │
#> │ --- ┆ --- │
#> │ f64 ┆ f64 │
#> ╞══════╪══════╡
#> │ 0.9 ┆ 1.0 │
#> │ -3.0 ┆ -1.0 │
#> │ -0.0 ┆ -0.0 │
#> │ 0.0 ┆ 0.0 │
#> │ 4.0 ┆ 1.0 │
#> │ null ┆ null │
#> └──────┴──────┘