You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Came across the same problem today. I am surprised that this problem dates back to as far as 2 years ago. Same problem still occurs in the current pandas version.
After poking into the code, I believe the problem is in DataFrameGroupBy._gotitem. It constructs a new GroupBy object and returns it. However, it does not pass the original group_keys to the constructor, so the default group_keys=True is used.
So the
apply()
results are different for these two case:ouput:
but
output:
The text was updated successfully, but these errors were encountered: