replace Missing value in Column Problem

How to replace missing values in one column with values from another column (e.g., fill missing values in “Column Header (right)” using values from “Column Header”)

Hi @lca50666

You can use the Rule Engine node

image

gr. Hans

5 Likes

You can do this with eg. column expressions node:

Prototype:
missingvalsfromothercol.knwf (74.2 KB)

Overview: (red highlighted cells were missing)

Formula:

if (isMissing(column("Header (right)"))) {
    column("Header")
} else {
    column("Header (right)")
}

3 Likes

@lca50666 or you could use the new Expression node:

if($[“Column_B”] = MISSING or $[“Column_B”] = NaN, $[“Column_A”], $[“Column_B”])

2 Likes

@HansS @MartinDDDD @mlauber71 Thank you to all the experts for your help. I chose the Column Expressions node to solve this issue.

4 Likes

@HansS … Small correction to the TRUE => line in the Rule Engine rule shown above :wink:

MISSING $Column Header (right)$ => $Column Header$
TRUE =>  $Column Header (right)$

br

4 Likes

@takbb sharp and alert as always :slight_smile:

3 Likes

lol, always easier to be “sharp and alert” with other people’s code, when they’ve done the work, than I am with my own :slight_smile:

3 Likes

I think this use case is what the Column Merger node is for.

You just need to make the “Column Header” column as the primary column, the “Column Header (right)” the secondary column, and then specify to populate results in the secondary column.

-Phil

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