Python Pandas Only Compare Identically Labeled DataFrame Objects
<p>I tried all the solutions here:
<a href="https://stackoverflow.com/questions/18548370/pandas-can-only-compare-identically-labeled-dataframe-objects-error">Pandas &quot;Can only compare identically-labeled DataFrame objects&quot; error</a> </p>

<p>Didn't work for me.  Here's what I've got.  I have two data frames.  One is a set of financial data that already exists in the system and another set that has some that may or may not exist in the system.  I need to find the difference and add the stuff that doesn't exist.</p>

<p>Here is the code:</p>

<pre><code>import pandas as pd
import numpy as np
from azure.storage.blob import AppendBlobService, PublicAccess, ContentSettings
from io import StringIO

dataUrl = "http://ichart.finance.yahoo.com/table.csv?s=MSFT"
blobUrlBase = "https://pyjobs.blob.core.windows.net/"
data = pd.read_csv(dataUrl)

abs = AppendBlobService(account_name='pyjobs', account_key='***')
abs.create_container("stocks", public_access = PublicAccess.Container)
abs.append_blob_from_text('stocks', 'msft', data[:25].to_csv(index=False))
existing = pd.read_csv(StringIO(abs.get_blob_to_text('stocks', 'msft').content))

ne = (data != existing).any(1)
</code></pre>

<p>the failing code is the final line.  I was going through an article on determining differences between data frames.</p>

<p>I checked the dtypes on all columns, they appear to be the same.  I also did a side by side output, I sorted teh axis, the indices, dropped the indices etc.  Still get that bloody error.</p>

<p>Here is the output of the first row of existing and data</p>

<pre><code>&gt;&gt;&gt; existing[:1]
         Date       Open   High    Low  Close    Volume  Adj Close
0  2016-05-27  51.919998  52.32  51.77  52.32  17653700      52.32
&gt;&gt;&gt; data[:1]
         Date       Open   High    Low  Close    Volume  Adj Close
0  2016-05-27  51.919998  52.32  51.77  52.32  17653700      52.32
</code></pre>

<p>Here is the exact error I receive:</p>

<pre><code>&gt;&gt;&gt; ne = (data != existing).any(1)
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "C:\Anaconda3\lib\site-packages\pandas\core\ops.py", line 1169, in f
    return self._compare_frame(other, func, str_rep)
  File "C:\Anaconda3\lib\site-packages\pandas\core\frame.py", line 3571, in _compare_frame
    raise ValueError('Can only compare identically-labeled '
ValueError: Can only compare identically-labeled DataFrame objects
</code></pre>