I have a dataframe:
df = pd.DataFrame({'start': [50, 100, 50000, 50030, 100000],
'end': [51, 101, 50001, 50031, 100001],
'value': [1, 2, 3, 4, 5]},
index=['id1', 'id2', 'id3', 'id4', 'id5'])
x y z
id1 foo bar 1
id2 bar me 2
id3 you bar 3
id4 foo you 4
id5 bar foo 5
And a list of permutations:
l = [(foo, bar), (bar, foo)]
I want to extract all rows which contain the permutation in column [x,y]:
(foo, bar) -> id1, foo, bar, 1
(bar, foo) -> id5, bar, foo, 5
How can I extract these rows dependent on two values?