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
x = pd.DataFrame({'x':[1,1,3,3],'y':[3,3,5,5]},index=[11,11,12,12]) y = x.stack() print(y) print(y.groupby(level=[0,1]).sum())
Ouput
11 x 1 y 3 x 1 y 3 12 x 3 y 5 x 3 y 5 dtype: int64 11 x 1 y 3 x 1 y 3 12 x 3 y 5 x 3 y 5 dtype: int64
The stack and group by sum are just the same.
Expected output:
11 x 2 11 y 6 12 x 6 12 y 10
The text was updated successfully, but these errors were encountered:
yep, looks a little buggy. As the following gives the expected output.
In [5]: y.reset_index().groupby(['level_0','level_1']).sum() Out[5]: 0 level_0 level_1 11 x 2 y 6 12 x 6 y 10
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Ouput
The stack and group by sum are just the same.
Expected output:
The text was updated successfully, but these errors were encountered: