Search code examples
group-bydata-analysisknime

How to add values of 2 rows of a duplicate row in KNIME?


I tried using several nodes like Math Formula, Rule Engine, Duplicate row filter node. But I was unable to simply add value of 2 rows while keeping other column same as it was.

rowid    col0   col1   col2
  0       He     80     1
  1       He     20     1

So, 2 rows are duplicate above. To add 2 rows of col1 i.e 80 + 20 , while keeping col2 = 1 i.e no addition applied. How do I get the output to be? :

rowid   col0   col1   col2
  0      He     100     1

Solution

  • All you needed was Groupby node then apply following configuration:
    Group columns: col0
    Manual aggregation : col1 -> Sum, col2 ->First

    And done!! It wasn't hard at all. Just lack of experience.