I have a python list as follows:
my_list =
[[25, 1, 0.65],
[25, 3, 0.63],
[25, 2, 0.62],
[50, 3, 0.65],
[50, 2, 0.63],
[50, 1, 0.62]]
Use the following:
my_list = [[25, 1, 0.65], [25, 3, 0.63], [25, 2, 0.62], [50, 3, 0.65], [50, 2, 0.63], [50, 1, 0.62]]
list_25 = sorted([item for item in my_list if item[0] == 25], key=lambda item: item[1])
list_50 = sorted([item for item in my_list if item[0] == 50], key=lambda item: item[1])
res = [[i[2], j[2]] for i,j in zip(list_25, list_50)]
Output:
>>> res
[[0.65, 0.62], [0.62, 0.63], [0.63, 0.65]]