Concatenating two identical dataframes and only keeping the new entries

32 views Asked by At

I have two dataframes which are identical asides from an extra row or two. How do I concatenate them together into one dataframe but only add on the new entries to the original dataframe?

I have tried using pandas to do this but I can only concatenate them together I can't figure out a way to only keep the new entries and have them added onto the original.

Would appreciate the help.

1

There are 1 answers

0
A.B On

You can concat and drop_duplicates

dfnew = pd.concat([df1,df2])
dfnew.drop_duplicates(inplace=True,keep=False)