I want to know how to find the intersection from the first entry in each sublist, and concatenate the two sublists with the last entry. In this example the output should be:
I have two nested lists:
list1 = [[123, Harold, 5], [321, John, 3], [222, John, 2]]
list2 = [[333, James, 3], [123, Harold, 6], [999, John, 2]]
OUTPUT: intersect_list = [[123, Harold, 5, 6]]
Is this possible without using pandas? And how? :-) Thank you!
Right now, I can only find full intersection (the whole sublist), but not only the first entry and then concatenating the last entry.
intersectionList = [value for value in list1 if value in list2]
Kind regards, Anders