← log operator page · numeric/log/ds_sc/manual_ex_1
pandas ✅ · DuckDB ✅
the logarithm of every measure of DS_1 to base 2, the number being the first operand.
Logarithm, Example 1, output verbatim. The parameter table calls op the base and num the number, but the page's examples read the first operand as the number: "log ( 1024, 2 ) gives 10".
Me_1 1024, 64 and 32 give 10.0, 6.0 and 5.0, which agrees with the scalar example; Me_2 has the page's values, printed with all the digits of a double, such as -0.4064071941354039. The output follows the examples, so it is not an erratum.
DS_r := log ( DS_1, 2 );
| Id_1 | Id_2 | Me_1 | Me_2 |
|---|---|---|---|
| 10 | A | 1024 | 0.7545 |
| 10 | B | 64 | 13.45 |
| 11 | A | 32 | 1.87 |
{
"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": "Integer", "role": "Measure", "nullable": true},
{"name": "Me_2", "type": "Number", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | Me_1 | Me_2 |
|---|---|---|---|
| 10 | A | 10.0 | -0.4064071941354039 |
| 10 | B | 6.0 | 3.749534267669262 |
| 11 | A | 5.0 | 0.9030382701129122 |
{
"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"}
]
}
]
}