0
import pandas as pd
df1 = pd.DataFrame({
    'Key':['Banana','Orange','Apple','Celery'],
    'Num':[22.1,8.6,7.6,10.2],
    'Color':['Yellow','Orange','Green','Green'],
    })
df2 = pd.DataFrame({
    'Key':['Banana','Orange','Apple','Celery'],
    'Num':[22.1,8.6,7.6,11.2],
    'Color':['Yellow','Orange','Blue','Green'],
    })

enter image description here

The first column is key in both data frames.

I changed the third value of "Color " has changed from Green to Blue and the 4th value of Num has changed from 10.2 to 11.2.

So I only need rows where I see any value has changed in any of their columns.

The resultant df should look like this:

enter image description here

Rohit Kumar Singh
  • 629
  • 1
  • 7
  • 15

0 Answers0