Expr.sign
methodView source ↗
def sign() -> TdExpr
Categories: numeric
Calculate the sign of element values.
Examples
>>> import tabsdata as td
>>>
>>> tf: td.TableFrame ...
>>>
>>> tf.select(td.col("val"), td.col("val").sign().alias("sign"))
>>>
┌────────┬──────┐
│ val ┆ sign │
│ --- ┆ --- │
│ f64 ┆ f64 │
╞════════╪══════╡
│ 0.0123 ┆ 1.0 │
│ 2.0244 ┆ 1.0 │
│ 0.0 ┆ 0.0 │
│ inf ┆ 1.0 │
│ -50.0 ┆ -1.0 │
│ 1.0 ┆ 1.0 │
│ NaN ┆ NaN │
│ null ┆ null │
│ -112.0 ┆ -1.0 │
│ 2142.0 ┆ 1.0 │
└────────┴──────┘