I have a csv-file, where missing values are marked with “m”. Knime sees the affected columns (basically all) as a string due to that. I need to do a classification and to be able to do so, my idea was to change the letter into a missing value, so after that I can convert the strings into numbers.
This needs to be done for all except one out of around 150 columns.
It would be amazing if anyone can provide a solution for that problem ! I tried around a bit with string manipulaton and java snippets as some posts suggested, but I don’t really know where to start as I’m new to knime.
The trick is that in the Column Expressions node, you need to reference the “current column” in the loop, which means the code looks something like this:
if (column(variable("currentColumnName"))=="m")
{
null;
}
else
{
column(variable("currentColumnName"))
}
just after I registered on here I found a short solution that seems to work as well. I used a String Manipulation block (multi.-column) and replaced the placeholder with empty. After that, a String To Number - Block recognized the empty spaces as missing values.
(Incidentally, thank you for marking my first answer as “solution” but actually, it wasn’t a great solution - just the only one I could think of quickly, so feel free to mark your own as the solution instead, as I don’t think I deserve it this time with yours being much simpler, faster and better! )