Skip to main content
Version: 1.4.0

Expr.round

def round(decimals: int = 0) -> Expr

Categories: numeric

Round floating point element values.

Parameters

parameter
decimals

number 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.00.0
1.11.0
2.02.0
│ inf ┆ inf │
│ null ┆ null │
│ NaN ┆ NaN │
└──────┴───────┘