Reputation:
I have 2 csv files of different length. I need to find and remove the rows in one file that do not exist in the other file. Is there an easy way to do this, other than looping through the 2nd file n times?
Upvotes: 0
Views: 41
Reputation: 323226
Assuming you load your csv file into df1, and df2
df1[df1.apply(tuple,1).isin(df2.apply(tuple,1))]
Upvotes: 1