compare two dataframes and get the different rows
have two df's
name password login_id
tom 1234 1
matt 4567 2
george 7469
stuart 3
name password login_id
tom 1234 1
matt 7859 2
george 7469 5
stuart 4682 3
Need to get the changed value complete rows
expected output
name password login_id
matt 7859 2
george 7469 5
stuart 4682 3
Need to get only rows which has changed in second df
You can try merge with indicator
df2.merge(df1,how='left',indicator=True).loc[lambda x : x['_merge']=='left_only']
name password login_id _merge
1 matt 7859 2 left_only
2 george 7469 5 left_only
3 stuart 4682 3 left_only
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.