-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: DataFrameGroupBy.agg with lists doesn't respect as_index=False #52849
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
Comments
This looks a bit hard, but I'll give it a try. If I won't be able to solve this within a week, I'll re-assign |
take |
There is also missing data in a1 |
The single missing number aside (from a1 column) - as this seems like a separate issue. What should be the expected output for gb.agg(["sum", "min"]) ?
Therefore, if I understand correctly - if we're passing only one argument to list, we want to overwrite the list behaviour & output sth similar to gb.agg("sum"), right ? My concern is that some could argue that current output for gb.agg(["sum"]) is correct - that if you're passing in a list, you do want the output df to include "sum" annotation. |
Are you meaning something like the following?
pandas prints a sparse representation for the index. A missing entry implicitly means it is repeated from above.
I originally had the incorrect columns in the OP; it should be a MultiIndex. The OP has been updated. |
Hey, I'm sorry but I'll need to drop this issue. Pandas is a bit too much for me right now, I'll come back to this in the future |
I believe this is because returning too early. As shown below, it didn't go through the pandas/pandas/core/groupby/generic.py Lines 1331 to 1333 in 935244a
|
take |
But Categorical data seems to be tricky. The current result = self._insert_inaxis_grouper(result)
result.index = default_index(len(result)) seems unable to deal with that. |
The expected output is:
In particular, the index is a RangeIndex and
a1
as well asa2
are columns.The text was updated successfully, but these errors were encountered: