Skip to main content
Version: 0.9.6

Expr.sign

def sign() -> Expr

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.01231.0
2.02441.0
0.00.0
│ inf ┆ 1.0
-50.0-1.0
1.01.0
│ NaN ┆ NaN │
│ null ┆ null │
-112.0-1.0
2142.01.0
└────────┴──────┘