Closed
Description
Something seems to be wrong with s1 == s2 when s1 and s2 don't have the same index. Here is a snippet example:
import operator
import pandas
s1 = pandas.Series([1,2], ['a','b'])
s2 = pandas.Series([2,3], ['b','c'])
s1 == s2
s2 == s1
with the output:
InIn [5]: s1 == s2
Out[5]:
a False
b False
In [6]: s2 == s1
Out[6]:
b False
c False
On the other hand using combine works fine:
In [7]: s1.combine(s2, operator.eq)
Out[7]:
a 0
b 1
c 0
In [8]: s2.combine(s1, operator.eq)
Out[8]:
a 0
b 1
c 0
I guess you can first align s1 and s2 and then compare them, but is there a good reason why this couldn't work out of the box?
There doesn't seem to be any tests for pandas.Series. eq for two series with a different index in pandas/pandas/tests/test_series.py. I have a patch lying around to add such a test and I could commit it if that's useful.