how do I change double and integers to 0 only in certain columns?

I have a table with a lot of columns. For just the columns that have total in the name I would like to change nulls to zeros (these are numeric).

I have seen the Missing Values Node, but I don’t know how to only do this for certain columns. Maybe I have to split my columns first and rejoin them? Maybe there is a better way?

Try this:

  1. Split Columns: Use the “Column Splitter” node with a regex pattern to separate columns containing “total.” For instance, use .*total.* to match these columns.
  2. Handle Missing Values: if your total columns are strings apply the “Multi-Column String Manipulation” node to the “total” columns. If the missing values are numeric columns with empty cells ad null, they are automatically recognized as missing values showing a red question marc there , and you can set the node to replace them with zero using the missing value node. If “null” is a string, use this node to replace “null” with an empty string first, then transform it into a missing value.
  3. Combine Columns: Use the “Column Appender” node to merge the processed “total” columns back with the rest of your data.

If you are nit sure, share the work flow and i can help you with.

2 Likes

As a novice, I always wonder if there is a faster way I just don’t know about. In this case, I was close, so thank you for confirming. It worked well.

Well… In fact there is a faster way, but I thought because of the question that I should give you the standard one.

Supposing you have something like:

then you can use something like:

In that way the column order is not altered.

Here is the work flow with also an additional solution:

Best luck with your KNIME journey.

Cheers,

AG.

3 Likes

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