← round operator page · numeric/round/ds_digits/manual_ex_1
pandas ✅ · DuckDB ✅
round to 0 digits on every measure of DS_1.
Rounding, Example 1, output verbatim: "The operator round rounds the operand to a number of positions at the right of the decimal point equal to the numDigit parameter."
Me_1 7.5, 7.1, 36.2 and 44.5 give 8.0, 7.0, 36.0 and 45.0; Me_2 5.9, 5.5, 17.7 and 24.3 give 6.0, 6.0, 18.0 and 24.0. Both stay Number, as numDigit is given.
DS_r := round(DS_1, 0);
| Id_1 | Id_2 | Me_1 | Me_2 |
|---|---|---|---|
| 10 | A | 7.5 | 5.9 |
| 10 | B | 7.1 | 5.5 |
| 11 | A | 36.2 | 17.7 |
| 11 | B | 44.5 | 24.3 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Id_2", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Number", "role": "Measure", "nullable": true},
{"name": "Me_2", "type": "Number", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | Me_1 | Me_2 |
|---|---|---|---|
| 10 | A | 8.0 | 6.0 |
| 10 | B | 7.0 | 6.0 |
| 11 | A | 36.0 | 18.0 |
| 11 | B | 45.0 | 24.0 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Id_2", "type": "String", "role": "Identifier"},
{"name": "Me_1", "type": "Number", "role": "Measure"},
{"name": "Me_2", "type": "Number", "role": "Measure"}
]
}
]
}