title: How can I compare two different sized data sets using Python Pandas?
body: <p>I am working on creating a script that compares two Excel sheets for differences and then writes the results of the comparison to a new CSV file. I have tried following tutorials but I get an error when trying to run my script: &quot;ValueError: Can only compare identically-labeled DataFrame objects&quot;. What am I doing wrong?</p>
  <p>My code is as follows:</p>
  <pre><code>import pandas as pd
  
  
  pd.set_option('display.max_rows', 2500)
  pd.set_option('display.max_columns', 2500)
  pd.set_option('display.width', 2000)
  
  df1 = pd.read_excel('Old Budget.xlsx')
  df2 = pd.read_excel('New Budget.xlsx')
  
  
  diffs = df1[df1!=df2]
  
  df1[df1!=df2].to_csv ('Differences.csv', index = False, header=True)
  
  print (diffs)
  </code></pre>
  <p>My example data frames:</p>
  <pre class="lang-python prettyprint-override"><code>import pandas as pd
  data = [['tom', 10], ['nick', 15], ['juli', 14],['kelly', 10], ['mark', 15], ['james', 14]]
  df = pd.DataFrame(data, columns = ['Name', 'Age'])
  df
  </code></pre>
  <pre class="lang-python prettyprint-override"><code>import pandas as pd
  data = [['tom', 60], ['nick', 15], ['juli', 10],['kelly', 10]]
  df = pd.DataFrame(data, columns = ['Name', 'Age'])
  df
  </code></pre>
  <p>Thanks.</p>