0

So I want to compare two dataframes that have 2 similar columns that can uniquely identify them. I want to create a new dataframe of dataframe 2 where these 2 columns are a match.

DF1:enter image description here

DF2: DF1

I wanted to match them by the 'Published' date and the 'Title' - I was using this but it wasn't working as intended:

df3 = df2[df2['Title'].isin(df1['Title']) & df2['Published'].isin(df1['Published'])]
Anonymous
  • 37
  • 5
  • `df3 = df2.merge(df1[['Title','Published']], on=['Title','Published'])` or `df3 = df2.merge(df1[['Title','Published']].drop_duplicates(), on=['Title','Published'])` – jezrael Nov 12 '21 at 14:15

0 Answers0