Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BUG: fixes #53935 Categorical order lost after call to remove_categor…
…ies (#54027) * Changed the default value for sort to 'False' in the difference method. This allows the difference method to then call the _difference method and finally call the _maybe_try_sort method. In the _maybe_try_sort_method it will sort the values if sort is not False. That's why in the original code haveing sort=None would still sort the categories. This way the code will only sort if you set sort=True. * Added test to show the variable value change behaves the way we want it to. * Added bug fix to whatsnew. * Changed bug fix implementation to simply check if the Ordered value is set to True, if so it sets sort=False in the call to difference in remove_categories. * Changed bug fix implementation to simply check if the Ordered value is set to True, if so it sets sort=False in the call to difference in remove_categories. * Switched the implementation to a ternary to check for ordered. This seems to work better since we are not overriding a default argument this way.
- Loading branch information