Issue 28518 multiindex interesection by nrebena · Pull Request #28735 · pandas-dev/pandas (original) (raw)
MultiIndex lexsort_depth now return sortorder if sortorder is not set to None
At first the error come from the intersection of the two indexes, that resulted in an unsorted index with an invalid lexsort_depth value. Then when looking at the lexsort_depth function I found the deeper error, where the returned lexsort_depth value were the number of level instead of the self.sortorder value.
After fixing that I implemented a check in the MultiIndex._verify_integrity function when a sortorder is given to raise if it no coherent with the lexsort_depth.
I added tests for the issue, for the lexsort_depth function, and fo raising error in the _verify_integrity function.
- closes merge fails to add suffixes on multiindex columns #28518
- tests added / passed
- passes
black pandas
- passes
git diff upstream/master -u -- "*.py" | flake8 --diff
- whatsnew entry