Suppose I have a 2D list in python (the length of each list within is not the same, say the first list have 3 elements, but the second one has 4 elements). I have another 1D list with exactly 2 elements. I need to find the indices of the 2D list that contain both the elements of the 1D list (need not to be in sequence). I want to do this task very efficiently as it will be a part of a huge analysis task (not using loops especially).
For example:
2D list: [[4, 0, 2], [0, 3, 2], [3, 0, 4], [5, 3, 4], [3, 5, 6], [8, 1, 2], [7, 3, 6], [1, 7, 6], [8, 7, 1], [2, 3, 7, 8]]
1D list: [3, 4]
output: 2, 3
It is not essential that I use the list structure, is there any other structure in python that I can do it more efficiently?