Pandas filter dataframe on multiple columns wrt corresponding column values from another dataframe
You need to merge dataframes like done here in Pandas Merge. You also need to read on dataframe joins which is a common topic in learning databases.Here I have not done any tweaking with indices i.e, whether to keep left ones or right ones but you can check the docs for better information on here Merge Docs Pydata
import pandas as pd

columns = &quot;a b c d e f&quot;.split()
data = '''1 1 1 x 1 5
1 1 1 x 1 6
1 1 1 y 1 5
1 1 1 y 1 7'''.split(&quot;\n&quot;)

data = list(map(lambda x:x.split(), data ))


left = pd.DataFrame(columns = columns, data=data)



    a   b   c   d   e   f
0   1   1   1   x   1   5
1   1   1   1   x   1   6
2   1   1   1   y   1   5
3   1   1   1   y   1   7


right = pd.DataFrame(data = [&quot;1 1 1 x 1 5&quot;.split()], columns=columns)


    a   b   c   d   e   f
0   1   1   1   x   1   5


pd.merge(left, right, how=&quot;right&quot;, on=[&quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;d&quot;])

    a   b   c   d   e_x f_x e_y f_y
0   1   1   1   x   1   5   1   5
1   1   1   1   x   1   6   1   5


pd.merge(left, right, how=&quot;right&quot;, on=[&quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;d&quot;], suffixes=[&quot;&quot;, &quot;_&quot;] ).drop([&quot;e_&quot;, &quot;f_&quot;], axis=1)


    a   b   c   d   e   f
0   1   1   1   x   1   5
1   1   1   1   x   1   6