I have a df1 that looks like:
Out[43]:
city1 city2
0 YYZ SFO
1 YYZ EWR
2 YYZ DFW
3 YYZ LAX
4 YYZ YYC
I have another df2 that I want to slice based on df1 i.e. city1 and city2 in df2 have to correspond to the same city1 and city2 pair in df1.
I only want rows in df2 where the city1 and city2 columns match exactly as those in df1.
Do I have to merge/join the dfs together as a left join on df1 as the only clean way to do this? I don't want to create another column with the value as a concatenation of city1 and city2. That will work but there must be an easy way that is built into pandas without having to manipulate my data.
UPDATE:
df2 has more than just 2 columns. It has a total of 20 columns. For simplicity I only mentioned city1 and city2.
In any case, I want to return all rows in df2 (df with 20 columns) where the city1 and city2 pair match what is present in df1.