Replacing missing values with value from different row

In the table below, some rows have items with missing weight value. I need to replace missing value by getting the item’s weight from a row where it is not missing.

How can I do this using knime, “Missing Value” node did not help…

Thanks!

missingValues

In the Missing value node you can use a previous value or a moving average. I think you might be able to combine that with a Group Loop if you want to do this per group. Might also help with your other question.

2 Likes

Hi. I had to do something similar to this. As an alternative method, here’s what I did…

  1. Use the GroupBy node to group by Item, aggregating by Weight using method “First” :
    image
  2. The GroupBy table will then be used as a lookup table by the Cell Replacer node. The Cell Replacer will be configured to add a new column (called ‘Replacement’) to the original table containing the looked up weight values. (Note: This results in a “Non-Native” column type, so we use the Column Auto Type Cast node to convert it to number type).
    image
  3. Use the Column Merger node to fill in the missing values using values in the Replacement column.
    image
  4. Remove the Replacement column using the Column Filter node (table not shown).

missing value.knwf (12.4 KB)

image

1 Like

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