'?' Column Datatype - How to convert column to double

I load data to knime, I got a column ‘?’ pleae find screenshot as below
image

I want to convert it to double, please guide

Background: I was doing concatenization of two files where in one file ‘PRODUCT_REV’ was as doube and in other file ‘PRODUCT_REV’ was as string.
Solution: Before concatenization, I converted ‘PRODUCT_REV’ to number using ‘string to number’ node. issue resolved now. – Thank you

2 Likes

Hi @theshreyansh , welcome to the forum, and good to see you found a solution.

For info, another possible solution is that after the concatenation you could use Column Auto Type Cast which will scan the data in the column and attempt to find a datatype that suits.

This might suit if you had a large number of initial input tables being concatenated and you wanted to “fix” the datatype in one hit, provided of course (just as with the use of String to Number that the column contains data of the expected type).

Another use case for this might be if you don’t definitively know in advance which of your input sources contains the numbers as Strings, but just know there’s a possibility of it occurring.

e.g.
image

The use of String to Number though is more “explicit” in terms of telling it what you want to do (you can for example specify Integer, Long or Double, but of course your data still has to all be compatible with the required datatype. So I’d probably generally go with the solution that you already found, unless as stated, we didn’t know in advance what we would be receiving datatype-wise.

6 Likes

Hello @theshreyansh,

how are you reading your data into KNIME? Wondering cause you get 2 different column types for same column…

Welcome to KNIME Community!

Br,
Ivan

1 Like

Hi @ipazin I am using csv reader for two separate files. both files hold same nature of data but on timescale, one file is current-time and other is historical-data. hope i answered your question. sorry if I dont understand it well. please do let me know if I should add more exaplination

I didnt know about ‘column auto type cast’ @takbb - thanks a lot because that is going to help me a lot :slight_smile:

Hi @ipazin,
the problem of different data types can occur while you have different sources where in one source the specific data column is empty or the source columns contains a mixture of nummeric and text information (e.g. in Excel Files) and one source only contains nummeric information.

I do have this issue with data fields which contains reference information or identifier depending of the source.

BR

Hello @morpheus and @theshreyansh,

I see. Thought that was behind it. Good news is this will be addressed in reader nodes with upcoming KNIME 4.4. version.

Br,
Ivan

1 Like

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