Reshape Data table without aggregation

Hey Guys,

 

I have a data table like this (col[2n-1]: class, col[2n]: value, for n=0,1,2,...):

A 1 D 4 B 8
B 4 B 7 A 5
C 6 C 3 C 9

and want to reshape it into:

A 1
B 4
C 6
D 4
B 7
C 3
B 8
A 5
C 9

By using groupby or pivote node I couldn't manage it so far. Does anyone have an idea?

Thanks!

 

I think by looping through the column(pair)s you can do this applying that to the column filter node with a Loop End (Column Append) node in the end. The problem might be how do you loop through the columns in pairs? Probably you do not: split to two tables, the keys and the values and loop on them independently, then join the results (the row keys should be the same).

Cheers, gabor

Hi,

you can do it much more simply if the exact row order is not important.

use a create collection column node and include all your columns containing the letters, choose the option to remove aggregated columns from table.

repeat again with another create collection column node but choose the columns containing the numbers this time.

now finally connect an Ungroup node selecting the two collection columns and choose the option remove selected collection columns.

i hope this works for you. You could follow this up with a sorter node if desired to get the desired row order.

simon.

Hey Simon & Garbor,

thanks a lot - both ways worked for me, Simon's in this case a bit faster since the row_id order was not that critical.

Cheers, H