tabsdata.tableframe.expr.expr.Expr.round#

Expr.round(decimals: int = 0) Expr[source]#

Round floating point element values.

Parameters:

decimals – number of decimal places to round to.

Example:

>>> 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   │
└──────┴───────┘