Code Sample, a copy-pastable example if possible
import pandas.util.testing as tm
tm.makeFloatIndex().difference(tm.makeStringIndex()) # returns dtype(float), should possibly be dtype(O)
tm.makeFloatIndex().symmetric_difference(tm.makeIntIndex()) # returns dtype(float), should possibly be dtype(O)
pd.Float64Index([1,2,3]).intersection(pd.Int64Index([1,2,3])) # returns dtype(float), should possibly be dtype(O)
Problem description
With this PR (https://github.com/pandas-dev/pandas/pull/23538), all union operations between inconsistent index types will return a standard index dtype of object. Perhaps this should hold true for all setops. The biggest violator of this currently would be difference, which just returns the left hand index. Intersection and symmetric difference handle this fine for the most part, however there are some cases where they do not respect this, for example FloatIndex.difference(IntIndex)
.
Output of pd.show_versions()
0.25.0.dev0
Comment From: gfyoung
cc @jreback given your involvement in #23538
Comment From: jbrockmendel
Closing as complete.