Filling missing values with a formula

Hi guys,

i have some missing values in a collumn but i want to fix this, using a formula... just like this...

if this value = null then pickup the previous row value...

How i do this in knime...

 

tks guys best regards.

You could solve it with the Java Snippet node.

Connect a Java Snippet node and in the global declaration field define a field "lastValue" (Int, last seen Value). In the method body field, define a script along the lines of:

if ($ValueColumnName$ == null) {
  $ValueColumnName$ = lastValue;
}else{
  lastValue = $ValueColumnName$;
}

And you should be good to go.

Beware of one catch: if the very first item is a null then you have a problem...

1 Like

The Time Series Missing Value node with the option Last does exactly this.

Cheers, Iris

I was hoping to use this node but I cannot find it in the current version of KNIME. I assume it has been discontinued? Any suggestions on how to recreate the functionality using current nodes would be most appreciated.

 

Stefan

The standard Missing Value node provides this functionality now.

Thank you. I can see how this node works to interpolate missing values for existing rows. What I am trying to accomplish is something a bit different. I wish to add rows when there is a missing value. So in the example below a new row would be added after row 4, with Year populated with the value 2016 and Customer ID with the same value as the row above.

Year  Customer ID

2012 CT108269
2013 CT108269
2014 CT108269
2015 CT108269
2017 CT108269