← trunc operator page · numeric/trunc/comp_placeholder/placeholder_for_digits
pandas ✅ · DuckDB ✅
the placeholder _ for numDigit, on a component inside calc.
Truncation: "trunc ( 12345.6, _ ) gives 12345".
Me_2 = trunc(Me_1, _) is an Integer, as with numDigit omitted: 3.14159, 2.71828 and 12345.6 give 3, 2 and 12345; the other components are kept.
DS_r := DS_1[calc Me_2 := trunc(Me_1, _)];
| Id_1 | Me_1 |
|---|---|
| 1 | 3.14159 |
| 2 | 2.71828 |
| 3 | 12345.6 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Number", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Me_1 | Me_2 |
|---|---|---|
| 1 | 3.141590 | 3 |
| 2 | 2.718280 | 2 |
| 3 | 12345.600000 | 12345 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Me_1", "type": "Number", "role": "Measure"},
{"name": "Me_2", "type": "Integer", "role": "Measure"}
]
}
]
}