← modulo operator page · numeric/modulo/comp_comp/integer_mod_number
pandas ✅ · DuckDB ✅
the remainder of an Integer component divided by a Number component, inside calc.
Modulo: "If one of the operands is of type number, then the other operand is implicitly cast to number and therefore the result has type number."
Me_3 = mod(Me_1, Me_2): 7 mod 2.5 = 2.0, 9 mod 4.0 = 1.0 and 10 mod 3.5 = 3.0, a Number; the other components are kept.
DS_r := DS_1[calc Me_3 := mod(Me_1, Me_2)];
| Id_1 | Me_1 | Me_2 |
|---|---|---|
| 1 | 7 | 2.5 |
| 2 | 9 | 4.0 |
| 3 | 10 | 3.5 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true},
{"name": "Me_2", "type": "Number", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Me_1 | Me_2 | Me_3 |
|---|---|---|---|
| 1 | 7 | 2.500000 | 2.000000 |
| 2 | 9 | 4.000000 | 1.000000 |
| 3 | 10 | 3.500000 | 3.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"},
{"name": "Me_3", "type": "Number", "role": "Measure"}
]
}
]
}