-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: join not working correctly with MultiIndex and one dimension categorical #38621
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
Conversation
pandas/core/indexes/base.py
Outdated
) | ||
): | ||
# Categorical is monotonic if data are ordered as categories, but join can | ||
# not handle this in case of not alphabetically monotonic GH#38502 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is alphabetical really the issue? what about numeric or dt64 Categoricals?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm bad wording probably. If the object is lexicographically ordered everything is fine. Monotonic in the sense of categorical monotonic is the problem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will add tests for different types of Categorical.s
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added float, int and timestamps.
Edit: They are all failling without the changes
� Conflicts: � doc/source/whatsnew/v1.3.0.rst � pandas/tests/reshape/merge/test_join.py
self.is_monotonic | ||
and other.is_monotonic | ||
and ( | ||
not isinstance(self, ABCMultiIndex) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you check _is_lexsorted instead rather than this specific check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue as with is_monotonic, depends on the categories too.
thanks @phofl |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff