given the example table,
ID T A B X Y Z
1 S 1
2 S 2
1 E 4 a b c
3 S 5
2 E 8 d e f
and the assumptions:
- for the same ID there is a pair of rows (first row T == S; second row T == E)
- in the first row (T == S) the columns ID, T, A have values
- in the second row (T == E) the columns ID, T, B, X, Y, Z have values
- the two row pairs are not necessarily below each other
I try to do the following:
- Look for rows with the same ID
- and merge the values (into the row T == S)
- remove rows with T == E // since merged with other row
The result would look like this
ID T A B X Y Z
1 S 1 4 a b c
2 S 2 8 d e f
3 S 5
...
Currently I use two nested for-loops, which is too slow. Has anybody a idea that is faster than two nested for-loops?