How can I compare results from two CSV files in Python with DictReader or Pandas? (Open to any other methods as well!)
<p>I am trying to compare results from two CSV files. I want it to check if the first column(ID_NUMBER) from CSV1 that matches CSV2, and then I want it to check if the values from rest of the columns match too, and give the output of "True" or "False" for the corresponding column. And At the end, I want to add a column; if all the row values are "True" it should be True, if there is one "False" it should be false
Here is the code I have:</p>

<pre><code>import csv
import os
import sys
import difflib

def compare():

list_csv1 = []
with open('query1_results.csv' , 'rb') as query_results1:
    reader1 = csv.DictReader(query_results1)
    for row1 in reader1:
        list_csv1.append(row1)

list_csv2= []   
with open('query2_results.csv' , 'rb') as query_results2:
    reader2 = csv.DictReader(query_results2)
    for row2 in reader2:
        list_csv2.append(row2)
</code></pre>

<p>CSV1:</p>

<pre><code>{'ID_NUMBER': '1J2Wh', 'CHECKING_CODE': '20', 'SECURITY_CODE': '0', 'JOB_ID': ''}
{'ID_NUMBER': '124ggfh', 'CHECKING_CODE': '100', 'SECURITY_CODE': '0', 'JOB_ID': 'O'}
</code></pre>

<p>CSV2:</p>

<pre><code>{'ID_NUMBER': '1J2Wh', 'CHECKING_CODE': '600', 'SECURITY_CODE': '0', 'JOB_ID': ''}
{'ID_NUMBER': '124ggfh', 'CHECKING_CODE': '100', 'SECURITY_CODE': '0', 'JOB_ID': 'O'}
</code></pre>

<p>Output I need:</p>

<pre><code>{'ID_NUMBER': '1J2Wh', 'CHECKING_CODE': FALSE, 'SECURITY_CODE': TRUE, 'JOB_ID': TRUE}
{'ID_NUMBER': '124ggfh', 'CHECKING_CODE': TRUE, 'SECURITY_CODE': TRUE, 'JOB_ID': TRUE}
</code></pre>