-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
API: groupby aggregation with apply does not drop groupby-column #22542
Comments
Related to #20420 - we generally have a few inconsistencies in apply that need to be cleaned up |
rather opening new issues pls look at open existing ones |
I did (https://github.com/pandas-dev/pandas/issues?page=2&q=is%3Aissue+is%3Aopen+apply+label%3AGroupby&utf8=%E2%9C%93), but did not find much - guess I did not go back far enough in time - sorry. Going over them a second time, I did overlook #13217, #15290 and possibly #18103 is somewhat related. I don't think there's something as comprehensive as what I'm trying to summarize in #22545, but #13056 is a start. |
closing as duplicate of #13217. ping me to reopen if I'm missing something. |
Fine with me. |
The docs for groupby say (http://pandas.pydata.org/pandas-docs/stable/groupby.html):
From the section, it's implied that this is talking about builtins and the
aggregate
functionality, but I very often find myself operating with complicated functions on the groups themselves, soapply
is my bread and butter (and this is part of a larger issue thatgroupby.apply
has some inconsistent behavior).For something like
sum
, the groupby-column gets dropped, as described:But for using the same function in
apply
, the result is different - mainly that the groupby column does not get removed (but also the dtype)Ideally, I'd like the make the behaviour of
groupby.apply
more consistent in a number of cases, and this is one of them.The text was updated successfully, but these errors were encountered: