I have a list with nested sub-list with the following structure
in_data =
[
[
['name', 'name_1'],
['item_B', '2'],
['item_C', '3'],
['item_D', '4']
],
[
['name', 'name_2'],
['item_B', '5'],
['item_A', '2']
],
[
['name', 'name_3'],
['item_B', '6'],
['item_C', '7']
]
]
I am trying to collect all data in in_data and make a unique list that contains sub-lists, one for all the "headers"/ names and one for each item + values in the correct order.
So the information is preserved but in a different data-structure.
I want to achieve this list:
res_list =
[
['name', ' name_1', ' name_2', 'name_3'],
['item_B', '2', '5', '6'],
['item_C', '3','-', '7'],
['item_D', '4','-', '-'],
['item_A', '-','2', '-']
]
I am trying to do it in the most pythonic way. I tried with for loops and also map() + lambda but no succeess.
would be the easy way?
'Skill'word should be skipped/ignored?