← length operator page · string/length/ds/manual_ex_1
pandas ✅ · DuckDB ✅
length(DS_1) on a dataset with one String measure, which becomes the Integer measure int_var; one value is null.
String length, Example 1, output verbatim: "Returns the length of a string." For a data set, "length returns a dataset with a single measure int_var of type integer."
int_var is 5 for hello and null for the null value. A null operand gives a null result: "most of the scalar operations (arithmetic, logical, and others) return null when any of their arguments is null" (User Manual).
DS_r := length(DS_1);
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | hello |
| 2 | B |
{
"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": "String", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | int_var |
|---|---|---|
| 1 | A | 5 |
| 2 | B |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Id_2", "type": "String", "role": "Identifier"},
{"name": "int_var", "type": "Integer", "role": "Measure"}
]
}
]
}