Expr.round
methodView source ↗
def round(decimals: int = 0) -> Expr
Categories: numeric
Round floating point element values.
Parameters
parameter
decimalsnumber of decimal places to round to.
Examples
>>> import tabsdata as td
>>>
>>> tf: td.TableFrame ...
>>>
>>> tf.select(td.col("val"), td.col("val").round().alias("round"))
>>>
┌──────┬───────┐
│ val ┆ round │
│ --- ┆ --- │
│ f64 ┆ f64 │
╞══════╪═══════╡
│ -1.0 ┆ -1.0 │
│ 0.0 ┆ 0.0 │
│ 1.1 ┆ 1.0 │
│ 2.0 ┆ 2.0 │
│ inf ┆ inf │
│ null ┆ null │
│ NaN ┆ NaN │
└──────┴───────┘