1

have two df's

df1

0       1 
1234   mark
4865   john
4866   joseph
7916   stuart

df2

0       1       2  
1234   mark    test1
4865   john    test2
4866   joseph  test3

expected output :

get the unique row comparing from both the dataframe and display the the unique column in df1

df1

0       1
7916   stuart 
DYZ
  • 55,249
  • 10
  • 64
  • 93
  • 1
    Have you tried anything? – AMC Dec 19 '19 at 05:43
  • What do you mean by "_display the unique column in `df1`_"? `df1` has only one column. – DYZ Dec 19 '19 at 05:44
  • tried merging , outer but i need to remove the rows from df1 when some of its rows matches with the df2 –  Dec 19 '19 at 05:44
  • 3
    Does this answer your question? [pandas get rows which are NOT in other dataframe](https://stackoverflow.com/questions/28901683/pandas-get-rows-which-are-not-in-other-dataframe) – AMC Dec 19 '19 at 05:44

1 Answers1

0

Yo can try as below

df1[(~df1['0'].isin(df2['0'])) & (~df1['1'].isin(df2['1']))]
      0     1
3   7916    stuart
moys
  • 7,747
  • 2
  • 11
  • 42