How to sum the numbers in a string column

hvalder01
hvalder01 Registered Posts: 2

I have a string column ("CylSize") with these values (7.5, 7.5, 5.125, 3.375).

We need to create a new column with the sum of all the values (7.5+7.5+5.125+3.375) = 23.5.

Please advise what is the best recipe to get it done.


Operating system used: Windows

Tagged:

Best Answer

  • Miguel Angel
    Miguel Angel Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 118 Dataiker
    Answer ✓

    Hi,

    The sum of elements in the same cell can be easily achieved by using a Prepare recipe. Within this recipe, there are various ways in which the desired results can be obtained.

    The most straigtforward path would be to take advantage of visual processors. For example, using the following: 'extract numbers', 'formula', and 'remove columns'.

    Capture.PNG

    Another option to do the operations in one go could be using a 'custom python function':

    Capture2.PNG

Answers

Setup Info
    Tags
      Help me…