How to replace column data with missing value

Hi!

I have a case where grouped data from a database dont have enough subdata so I want to set those as missings. The percentage limitation is a flow variable, set to 97,0 (percent).

The KNIME table looks like:
percentage year minvalue avgvalue maxvalue
99.99 1996 1 3 5
98.00 1997 2 3 4
96.50 1998 3 4 5
100.00 1999 4 5 6

I want the output for 1998 to be:
96.50 1998 ? ? ?

Tested almost a douzen of nodes without finding a way!? One of the reasons why I want to do this is to show data in line plots with “gaps”, for educational purpose! I know that missings may be a problem otherwise in this and in following up nodes it will work!

Regards,

Batjesen

Hi @Batjesen

you can use the Jave Snippet Node.

BR
Hermann

2 Likes

Thanks Morpheus,

That looks like promising! Havent coded java before but at least 10 other programming languages since the late 70-ies… Time for something new…

I’m already on it and testing…

Ingemar/Batjesen

1 Like

This worked as a charm! Thank you!

Looks like you’ve got a solution already, but I just wanted to add that you could do the same with a few Rule Engine nodes, or a Column Expressions node. :slight_smile:

2 Likes

Thanks ScottF,

Yes those nodes, Rule Engine and Column Expression, were among those nodes I tested, but could not make them work. I have made a lot of progress in KNIME and can produce a lot of good calculations and reports, but I think I’m stuck at being a ‘old school’ programmer, and hasn’t got a deep understanding of how those rule based nodes really work, or most particular - how to ‘force’ something to missing value.

Regards,

Batjesen/Ingemar

Hi @Batjesen -

Here’s a short workflow to demonstrate what I was talking about. You can either use a series of Rule Engine nodes, or a single Column Expression node.

2020-02-27 15_47_59-KNIME Analytics Platform
ConditionalMissingReplacementExample.knwf (12.9 KB)

It’s really just about knowing the syntax - nothing too complicated. As usual, there’s always multiple ways to accomplish a task in KNIME. Hope this helps!

4 Likes

Thanks @ScottF, I will keep these for future reference. I really like these small samples!

Batjesen/Ingemar

2 Likes

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