forked from pandas-dev/pandas
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit 20cff0d
authored
Revert 1 groupby ordered observed (#2)
* BUG: Fix groupby sorting on ordered Categoricals (GH25871) (#1)
* BUG: Fix groupby on ordered Categoricals (GH25871)
As documented in pandas-dev#25871, groupby() on an ordered Categorical messes up category order when 'observed=True' is specified.
Specifically, group labels will be ordered by first occurrence (as for an unordered Categorical), but grouped aggregation results will retain the Categorical's order.
The fix is a modified subset of pandas-dev#25173, which fixes a related case, but has not been merged yet.
* BUG: Fix groupby on ordered Categoricals (GH25871)
* new test
* Fix groupby on ordered Categoricals (GH25871)
Testing all combinations of:
- ordered vs. unordered grouping column
- 'observed' True vs. False
- 'sort' True vs. False
In all cases, result group ordering must be correct.
The test is built such that the result index labels are equal to aggregation results if all goes well (except for the one unobserved category)
* Revert "BUG: Fix groupby sorting on ordered Categoricals (GH25871) (#1)"
This reverts commit b265349.1 parent 2c2500b commit 20cff0dCopy full SHA for 20cff0d
File tree
0 file changed
+0
-0
lines changedFilter options
0 file changed
+0
-0
lines changed
0 commit comments