Knime String to Number failing

I’ve checked the forum notes and can’t find a solution to my problem.

Leading up to error: there’s a lot of processing, but when I use Groupby it always converts my Integers to Strings. I need to convert them back to Integers for a series of regressions and other math analyses.

The particular Integers are four-digit numeric IDs for varying categories.

When I try to convert String to Number I get the error “WARN String To Number 0:4485 Values in 203 cells could not be parsed, first error: ‘5004, 5005, 5005, 5004, 5005, 5005, 5005, 5005, 5005, 5005, 5005, 5005, 5005, 5005, 5005, 5005, 5005, 5005, 5007, 5005, 5005, 5005, 5005, 5005, 5005, 5005’ (RowKey: Row0, Position: 6)
WARN String To Number 0:4485 Problems occurred, see Console messages.”

Attached are my screenshots and data set. I am guessing it may have something to do with me combining columns and creating long arrays of data–but I need the data in this configuration.
Thank you




temp.xlsx (56.5 KB)

Hey @smithcreed,

the String To Number node only works, if there is just a single number in a cell. As it seems, your numbers are being concatenated by using the GroupBy node. You will get a string of numbers separated by a comma (or any other delimiter defined in the GroupBy node). The String To Number cannot parse the number then, because it’s not a single one.

The question of how to proceed depends on how you want and how you need your data to be structured for the next tasks. If you want to have them as an array/collection you can select Set or List as aggregation method in the GroupBy node. Their original data type will then stay the same. You can use the ungroup node to expand collections and you will get the original row format of these values back. If you choose concatenate, you can split the string afterward using the Cell Splitter node. This node will then either create a collection or a new column for each number in the concatenated string. Then you can use the String To Number node.

I hope this helps!

Best,
Julian

2 Likes

Hi Julian, thanks for the help. I actually worked my way up stream in the data processing and broke out each category separately to complete a successful pivot–and did so using data in single cells. I’m now in the process of joining all of the separate categories back into a single table.

2 Likes

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