← cast operator page · general/cast/number_to_string/plain_decimal_notation
pandas ✅ · DuckDB ✅
cast(Me_1, string) on a Number measure, without a mask: the default format.
Type conversion: "From number: the number value may be printed either in the scientific notation, or as a sequence of digits, possibly preceded by a -, with . as the decimal separator, without any leading zeroes or thousands separators."
The sequence of digits, 3.5 and -12.75, values exact in binary floating point; they are not between -1 and 1, so the reading of "without any leading zeroes" (0.5 or .5) does not matter. A scientific result, which the manual allows too, would not match these strings.
DS_r := DS_1[calc Me_2 := cast(Me_1, string)];
| Id_1 | Me_1 |
|---|---|
| 1 | 3.5 |
| 2 | -12.75 |
{
"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.5 | 3.5 |
| 2 | -12.75 | -12.75 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Me_1", "type": "Number", "role": "Measure"},
{"name": "Me_2", "type": "String", "role": "Measure"}
]
}
]
}