Convert Columns into row

I want to covert columns into row. How can I do that?
I have a table like this.
and I want result like this
image .

Hi. Please note that in KNIME column names must be unique, so you might consider naming your columns X1, Y1, X2, Y2, etc.
One way to do this is to filter your table to contain only the name and X columns. Then create a collection column containing the values from the X columns, and then UnGroup by the collection column you just created. This will give you the desired output table with the Name and X columns.
Repeat the process for the Y columns and the use the Column Appender node to combine the two tables. Finally filter out the duplicate Name column. (see attached workflow).
Hope this helps

convert cols into rows.knwf (17.2 KB)



Nice! :+1:
But you could use two Create Collection Column nodes and a Ungroup node. There is no need to separate the columns and then append them.

Regarding the solution provided by @dnaki, you can select columns using Wildcard or regex in the Create Collection Column nodes instead of filtering and then appending.
Moreover, if you have several column groups, you can aggregate columns inside a loop.
Here is modified version of @dnaki’s workflow:

convert cols into rows.knwf (78.7 KB)



Nice improvements, @armingrudd !


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