← power operator page · numeric/power/sc_comp/integer_exponents
pandas ✅ · DuckDB ✅
power of a scalar base with the exponent in a component, inside calc.
Power types exponent as component<number> | number, so it may be a component while the base is a scalar.
Me_2 = power(2, Me_1): 2^3 = 8, 2^-1 = 0.5 and 2^10 = 1024, a Number although both operands are Integers; the other components are kept.
DS_r := DS_1[calc Me_2 := power(2, Me_1)];
| Id_1 | Me_1 |
|---|---|
| 1 | 3 |
| 2 | -1 |
| 3 | 10 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Me_1 | Me_2 |
|---|---|---|
| 1 | 3 | 8.000000 |
| 2 | -1 | 0.500000 |
| 3 | 10 | 1024.000000 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Me_1", "type": "Integer", "role": "Measure"},
{"name": "Me_2", "type": "Number", "role": "Measure"}
]
}
]
}