BUG: Inconsistent behavior in Index.difference #35217
Labels
Bug
Index
Related to the Index class or subclasses
Numeric Operations
Arithmetic, Comparison, and Logical operations
Milestone
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Index.difference
seems to be treating float vs object / int vs object differently.Code Sample, a copy-pastable example
Problem description
Index.difference should probably not type-cast and compare the elements to honor consistent behavior with other types where they are not being type-casted.
Expected Output
or
All empty Index objects like in case of int vs object.
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : None
pandas : 1.0.5
numpy : 1.19.0
pytz : 2020.1
dateutil : 2.8.1
pip : 20.1.1
setuptools : 49.1.0
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pytest : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
numba : None
None
The text was updated successfully, but these errors were encountered: