Closed
Description
ci = pd.CategoricalIndex([1, 2, np.nan, 3])
other = pd.Index([2, 3, 4])
res = ci.get_indexer(other)
>>> res
array([1, 3, 2])
The 4 in other
is getting mapped to the nan
in ci
. Best guess is that this is passing other
to the Categorical constructor which will return Categorical([2, np.nan, 3], dtype=ci.dtype)
. If correct, this would be avoided by #40996.
Expected Behavior
>>> res
array([1, -1, 2])