0

I have a dataframe df:

columnA    columnB    columnC    columnD
A           BB           10         20
A           AA           15         15
B           AA           20         10

And another dataframe df2:

columnA   columnB
A           BB
B           AA

How can I filter the dataframe df in a pythonic way that I only keep the values if the subdataframe df2 have the excat combination of columnA and columnB. The expected output for df is:

columnA    columnB    columnC    columnD
A           BB           10         20
B           AA           20         10
PV8
  • 5,799
  • 7
  • 43
  • 87

0 Answers0