Round numbers
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 place.
Before
| item | price | tax |
|---|---|---|
| Widget | 12.34567 | 1.23456 |
| Gadget | 7.89012 | 0.78901 |
2 rows · 3 cols
Round numbers (columns=[price, tax], decimals=2)
After
| item | pricenew | taxnew |
|---|---|---|
| Widget | 12.35 | 1.23 |
| Gadget | 7.89 | 0.79 |
2 rows · 3 cols
Configuration
| Config key | Type | Required | Description |
|---|---|---|---|
columns | string[] | Yes | Numeric columns to round |
decimals | int | No | Decimal places (default 0) |
Generated Python code
df_2 = df_1.round({'amount': 2})
Tips & common mistakes
decimals: 0returns floats, not integers (e.g.3.0). Use Change types →integerif you need whole numbers.- Listing a non-numeric column will error — round only numeric columns.