ā cast operator page Ā· general/cast/string_to_number_mask/decimal_mask
pandas ā Ā· DuckDB ā
cast(Me_1, number, "DD.DDD") on a String measure: the mask of the page's Example 1, cast(m1, number, "DD.DDD") + 2.
Type Conversion and Formatting Mask: "āDā one numeric digit (for the mantissa of the scientific notation)" and "ā.ā (dot) can be used as a separator between the integer and the decimal parts".
12.375, and 3.5 from 03.500: two digits, a dot and three digits. The conversion without a mask, which skips leading zeroes, gives the same: the mask shows in the strings that it refuses, such as 12.5 or 12.3755.
DS_r := DS_1[calc Me_2 := cast(Me_1, number, "DD.DDD")];
| Id_1 | Me_1 |
|---|---|
| 1 | 12.375 |
| 2 | 03.500 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "String", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Me_1 | Me_2 |
|---|---|---|
| 1 | 12.375 | 12.375 |
| 2 | 03.500 | 3.5 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Me_1", "type": "String", "role": "Measure"},
{"name": "Me_2", "type": "Number", "role": "Measure"}
]
}
]
}