multiply
Hi - I have a very simple request but I am unable to work it out.
I have 2 columns on a dataset which I need to multiply one by the other?
Example one column is in USD and then I have a rates column and I want to multiply one by the other to give a number?
Answers
-
Hello @David_Mellamphy
,In a prepare recipe, you can add a new "Formula" preprocessor. If one column is named "cost" and the other is "rate", your formula would look something like
cost * rate
and the result will be in whatever "Output column" is set to.
I hope this helps,
Max
-
You can do it several ways including using SQL, Python, R, Visual Recipe, etc.
Using a Prepare Visual Recipe:
- Add new step, "Formula" from the Processor Library
- Set the formula to numval("dollars")*numval("rate"). Numval() tells dataiku to use the number value of that row from column "x".
You might have to do some pre-processing if some rows have null values or storage type is not an integer/double .
Have fun!