Problem with Cell Splitter returning last column as double

Hello! So, I was using cell splitter with Guess size and column types enabled.
I was assuming since I did not check “has column headers” on the CSV reader that the cell splitter will convert everything as strings.

Everything’s OK, however the last column returns as double. My column headers are all numbers (barcodes), by the way, and all are converted into strings except for the last one.

How do I fix it?

Hi @john_mark,

welcome to KNIME Community!

If you check node description of Cell Splitter you’ll see that when Guess Size and Column Types option is checked column type is determined so you’ll get column type based on cell’s content. The reason why all columns before the last one are string is cause they have empty strings values in them as opposed to last column which has missing values (red question mark). And this is I guess cause of your data and how it is read with CSV Reader node. If you know number if columns choose option Set array size and all columns will be type string.

Additionally why haven’t you checked Has Column Header option if those are headers? There is option in Cell Splitter to split input column name as well…

Br,
Ivan

2 Likes

Hi Ivan.

Thank you!

I went through my files again and replaced every line break with a “tab and a line break” to remove the missing values which fixed the column data type.

My files have different number of columns so I cannot use a fixed array size.

My bad on the column headers. I forgot I was using cell splitter and not the csv reader to split my column. :rofl:

Regards,
Mark

1 Like

Hi @john_mark,

glad you made it. I was thinking why not check option Has Column Header in CSV Reader node upon reading data into KNIME if those are headers?

Br,
Ivan

hi @ipazin

Ah yes.

I had a list of files in a loop.

The reason why I did not check the “Has Column Header” option because I have different number of headers per file; and these column headers probably have different set barcodes in it too.

The Cell Splitter takes in the exact value of the column header from my first file and so I can’t use the option.

With “Has Column Header” disabled on the CSV reader, I have a constant name column in Cell Splitter ( as Col0) and then I would just promote the first row as column header after.
image

Regards,
Mark

Hi @john_mark,

I see. Makes sense. Tnx for explanation.

Br,
Ivan

1 Like

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