values missing comparing datasets 1

values missing comparing datasets

In [119]:

common = df1.merge(df2,on=['col1','col2'])
print(common)
df1[(~df1.col1.isin(common.col1))&(~df1.col2.isin(common.col2))]
   col1  col2
0     1    10
1     2    11
2     3    12
Out[119]:
   col1  col2
3     4    13
4     5    14

Here is what the above code is Doing:
1. Create a new dataframe called common that contains the rows that are common between df1 and df2.
2. Print the contents of common.
3. Create a new dataframe called df1_unique that contains the rows that are unique to df1.

Similar Posts