Replace negative values

Hi. I have a question. I have got an an integer type attribute called Num_of_Loan. It says to set the value to zero if the original values are negative. As I saw, there are negative values in num of loan. How do I replace them with zero?
Another question. two attributes num_bank_account and num_credit_card. It says to take their absolute values. How to do that?
Thanks. I appreciate the help

Hi @Ammar_74

Task one can be done with a Rule Engine:

$column1$ < 0 => 0
TRUE => $column1$

Task two is a job for the abs() function.

5 Likes

@ArjenEX you have been faster :slight_smile:

Hey @Ammar_74,

you could achieve the replacement of negative values with the Rule Engine – KNIME Community Hub node by using the following expression

$Num_of_Loan$ < 0 => 0
TRUE => $Num_of_Loan$

Regarding your second question Iam not sure what you want to achieve, maybe you could show some example values and what you want to output exactly.

Best regards
Lars

3 Likes

Thank you so much, it worked perfectly. BTW ,
About the second part abs() function. Which node do i use?

Credits should go to @ArjenEX :slight_smile:

1 Like

You can use the Math Formular node.

1 Like

Hello. Sorry for bothering you. I have an attribute Num_of_Delayed_Payment. The task is to replace the non-numerical symbols and convert to integer format. I check that the non numerical values are 3_, _7 etc. I removed them using string manipulation. But there are also negative values such as -1 etc. Do I also remove the minus? Is minus a non numerical symbol? Also I will convert to integer type using string to number.
Thanks a lot!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.