Compare between 2 Excel files and give difference based on key column
<p>I have 2 excel files (which can be coverted to CSV).</p>

<pre><code>File 1:
Last Name  First Name  id(10 digit)  email   age  course
   abc       def       1234567890    axd     00    y2k
   bcd       efg       9012345875    bxe     11    k2z
   cnn       nbc       5678912345    cxn     00    z2k

File 2:
Group_ID    email     Person_ID  Name(Last,First)
1            axd      1234567890   def,abc
             cxn      5678912345   nbc,cnn
</code></pre>

<p>So I want to generate a file, which after comparing the file1[id] and file2[Person_ID] would give me the result (I could also compare between file1[email] and file2[email] as both the Person_ID and email should be unique in each row:</p>

<pre><code>bcd       efg       9012345875    bxe     11    k2z
</code></pre>

<p>I haven't yet figured out what and how to use, but you could tell me what python df functions I could use.</p>

<p>Assuming that you read file 1 and file 2 into pandas data frames df1 and df2,</p>

<p>df1.loc[df1['id'] != df2['Person_ID']]</p>

python csv pandas