We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
df.groupby(..., observed=True) behaves inconsistently for unordered Categoricals:
df.groupby(..., observed=True)
>>> df = pd.DataFrame({'A': pd.Categorical(['b', 'a']), 'B': [1,2]}) >>> df.groupby('A', observed=False).sum() # ok B A a 2 b 1 >>> df.groupby('A', observed=True).sum() # not ok B A b 1 a 2
Because the sort parameter in the groupby is implicitly True, the second result should be the same as if sort_index had been called:
sort
sort_index
>>> df.groupby('A', observed=True).sum().sort_index() # ok result, but shouldn't be needed B A a 2 b 1
My guess is that somewhere there is missing a if sort: obj.sort_index() block or similar.
if sort: obj.sort_index()
The text was updated successfully, but these errors were encountered:
This is fixed on main and is tested in test_category_order_reducer.
test_category_order_reducer
Sorry, something went wrong.
That’s really great. 👍
Successfully merging a pull request may close this issue.
Uh oh!
There was an error while loading. Please reload this page.
df.groupby(..., observed=True)
behaves inconsistently for unordered Categoricals:Because the
sort
parameter in the groupby is implicitly True, the second result should be the same as ifsort_index
had been called:My guess is that somewhere there is missing a
if sort: obj.sort_index()
block or similar.The text was updated successfully, but these errors were encountered: