Intersection of Two data frames in Pandas can be easily calculated by using the pre-defined function
merge(). This function takes both the data frames as argument and returns the intersection between them.
pd.merge(df1, df2, how)
A B C 0 3 efg Rahul 1 4 ghi Shubham
A B C 0 1 Geeks Nikhil 1 2 For Rishabh
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course