Skip to content

Backport PR #42089 on branch 1.3.x (BUG: RecursionError with CategoricalIndex.get_indexer) #42093

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3410,7 +3410,9 @@ def get_indexer(
if is_categorical_dtype(target.dtype):
# potential fastpath
# get an indexer for unique categories then propagate to codes via take_nd
categories_indexer = self.get_indexer(target.categories)
# Note: calling get_indexer instead of _get_indexer causes
# RecursionError GH#42088
categories_indexer = self._get_indexer(target.categories)
indexer = algos.take_nd(categories_indexer, target.codes, fill_value=-1)

if (not self._is_multi and self.hasnans) and target.hasnans:
Expand Down