← trunc operator page · numeric/trunc/comp_no_digits/manual_ex_2
pandas ✅ · DuckDB ✅
trunc with numDigit omitted, on a component inside calc.
Truncation, Example 2, output verbatim: "The basic scalar type of the result is integer if numDigit is omitted, number otherwise."
Me_10 = trunc(Me_1) is an Integer: 7.5, 7.1, 36.2 and 44.5 give 7, 7, 36 and 44; the other components are kept.
DS_r := DS_1[ calc Me_10:= trunc( Me_1 ) ];
| 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 | Me_10 |
|---|---|---|---|---|
| 10 | A | 7.5 | 5.9 | 7 |
| 10 | B | 7.1 | 5.5 | 7 |
| 11 | A | 36.2 | 17.7 | 36 |
| 11 | B | 44.5 | 24.3 | 44 |
{
"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"},
{"name": "Me_10", "type": "Integer", "role": "Measure"}
]
}
]
}