Yesterday I had uploaded a .csv and funny characters where in there, ie: í>>?“”" so I set a column rename and continued the workflow.
Today I have entered a new .csv file and the funny characters are gone only to find Column0.
I would like to check that column name, for something specific, for example:
if its name is NOT ‘color’, then rename it to ‘car’, if it’s ‘car’ obviously do nothing.
How can I accomplish this? My workflow now has a column w a different name. I am afraid if I fix this column now, next time I add a new file, the funny characters will be there again then I have to redo the node conditions every time.
Another user recently experienced something similar. The Column Rename (Regex) is a way to tackle this problem:
With the example that you mentioned, you can use ^(?!.*color).*$ as Regex term and replace it with ‘’‘car’
Dummy input:
Column Rename Regex
Note: KNIME automatically adds sequential numbers for columns equally named.
For the special characters cleansing, it’s even easier. If you know which chars you expected in your columns, you can clean-up anything that does not meet those requirements.
For example with these headers:
Let’s assume that your columns normally only contains letters and numbers, you can use [^A-Za-z0-9] and replace it with a blank or a character of your choice.