Skip to content

Specify that both by and level should not be specified in groupby - GH40378 #47778

New issue

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

Merged
merged 4 commits into from
Jul 18, 2022

Conversation

GivyBoy
Copy link
Contributor

@GivyBoy GivyBoy commented Jul 18, 2022

@mroeschke mroeschke added this to the 1.5 milestone Jul 18, 2022
@mroeschke mroeschke merged commit 833ef31 into pandas-dev:main Jul 18, 2022
@mroeschke
Copy link
Member

Thanks @GivyBoy

@@ -345,6 +345,17 @@ Index level names may be supplied as keys.

More on the ``sum`` function and aggregation later.

When using ``.groupby()`` on a DatFrame with a MultiIndex, do not specify both ``by`` and ``level``.
The argument validation should be done in ``.groupby()``, using the name of the specific index.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the last line here is coming from #40378 (comment). I was stating that the pandas code should validate the arguments, I don't understand what this sentence means in the documentation.

Also, I think this should be specified in the API docs for Series/DataFrame.groupby too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! Thanks for the comments. I have submitted a new pull request (#47825). Feel free to look at the code. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: TypeError when trying to group on column name and index level at the same time
3 participants