← subtraction operator page · numeric/subtraction/sc_comp/scalar_minuend

Scalar minuend 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

a component subtracted from a scalar, so the order matters.

Manual:

Subtraction: op1 is "the minuend" and op2 is "the subtrahend".

Expected:

Me_3 = 10 - Me_1 is 8, 6 and 5, an Integer; the other components are kept.

script.vtl ⇩

DS_r := DS_1[calc Me_3 := 10 - Me_1];

input/DS_1.csv ⇩

Id_1Me_1Me_2
122.5
244.0
350.5

input/DS_1.json ⇩

{
  "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}
      ]
    }
  ]
}

expected/DS_r.csv ⇩

Id_1Me_1Me_2Me_3
122.5000008
244.0000006
350.5000005

expected/DS_r.json ⇩

{
  "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": "Integer", "role": "Measure"}
      ]
    }
  ]
}