Ciaren

Round numbers — roundNumbers

Round numeric columns to a number of decimals.

Use cases

  • Tidy currency to 2 decimals before export.
  • Reduce noisy precision for display.

What it does

Rounds each value in the target columns to decimals decimal places in the output.

Round numbers (columns=[price, tax], decimals=2)
Before
itempricetax
Widget12.345671.23456
Gadget7.890120.78901
2 rows · 3 cols
After
itempricenewtaxnew
Widget12.351.23
Gadget7.890.79
2 rows · 3 cols

Configuration

Config keyTypeRequiredDescription
columnsstring[]YesNumeric columns to round
decimalsintNoDecimal places (default 0)

Generated Python code

These exports round only amount to two decimal places (columns: ["amount"], decimals: 2). Other columns remain unchanged; the illustration above rounds price and tax.

pandas

python
df_2 = df_1.round({'amount': 2})

Polars

python
df_2 = df_1.with_columns(pl.col('amount').round(2))

Tips & common mistakes

  • Rounding a floating-point column keeps it floating point (e.g. 3.0 with decimals: 0). Use Change types → integer if you need whole numbers.
  • Listing a non-numeric column will error — round only numeric columns.

See also