Open mansenfranzen opened 7 years ago
no this has to do with the upcasting rules. numpy is not used here except in a small evaluation case. upcasting of the mixed operands is actually somewhat non-trival, see the code https://github.com/pandas-dev/pandas/blob/master/pandas/core/algorithms.py#L372
welcome for you to add your test case and debug. there are quite a few tests around this so this might be tricky to get right.
Expected correct behavior for the same compartor dtypes
Non expected behavior for mixed comparator dtypes
In summary,
eq()
andisin()
return different results when mixing comparator dtypes.Problem description
Both methods
eq()
andisin()
should return the same result. Here is the related SO article.This issue might originate in numpy and perhaps is not directly pandas related (see here for more). Scalar comparison (equivalent to
eq()
) and array comparison (equivalent toisin()
) comparison yield different results for mixed comparator dtypes in numpy, too.Output of
pd.show_versions()