What is the pythonic way to reorganize my next data?
I have data
data = [
['a','b',1], ['a','b',2], ['a','b',3],
['a','c',3], ['a','c',4],
['f','g',2], ['f','g',5], ['f','g',9]
]
And I want to rearrange it in the following format:
data = [
['a', 'b', 1, 2, 3],
['a', 'c', 3, 4],
['f', 'g', 2, 5, 9]
]
So basically these two first elements in each internal list are a way to distinguish different elements, and the next number is data. I want to have only one row for each element that contains all the data.