# Data manipulation: rows to columns

Hi,
I'm  working in a workflow with a loop and a I've some problems
In each loop iteration, the loop load a diferent weka model than generated 3 o more columns. When the loop finished I have three columns with all iterations one behind last, like this
:

Row ID    class A   Class B   iteration
Row1#0    0.9406    0.5938    0
Row2#0    0.3040    0.6959    0
...
RowN#0    0.3040    0.6959    0
Row1#1    0.3040    0.6959    1
Row2#1    0.3040    0.6959    1
...
RowN#1    0.3040    0.6959    1
RowN#2    0.3040    0.6959    2
Row1#2    0.3040    0.6959    2
Row2#2    0.3040    0.6959    2
...
RowN#2    0.3040    0.6959    2
...
...
...

Row1#M    0.3040    0.6959    M
Row2#M    0.3040    0.6959    M
...
RowN#M    0.3040    0.6959    M

How can put each iteration results beside previous iteration results? or
How can I convert the rows generated in each iteration in new columns so they generate one table like this?

RowID  A      B    iter. A       B   iter.  A      B   iter.   A       B     iter.
Row1  0.9406  0.5938  0  0.3040  0.6959  1  0.3040  0.6959  2  0.3040  0.6959    M
Row2  0.3040  0.6959  0  0.3040  0.6959  1  0.3040  0.6959  2    0.3040  0.6959    M
...                                     ...                               ...
RowN  0.3040  0.6959  0  0.3040  0.6959  1  0.3040  0.6959  2    0.3040  0.6959    M

thanks

So once you have generated your list above, use a groupby node on the iteration column to get the list of iterations, then convert to a variable using a table row to variable loop start.
Now use a row filter node and choose to filter on the iteration column using the variable as the filter text.
Now use the rowid node to generate a fresh set of row ids.
Now use a loop end column append node.
That should get you somewhere there to what you need.

Simon.

In fact, why not just change your Loop End node for a Loop End (Column Append) node in your original loop. Does this do what you desire ?

Simon.

Hi Simon

yes, the Loop End (Column Append) node is the solution.

Thanks and I apologise for making you waste your time.