REGR: 1.3 behavior change with groupby and asindex=False
See original GitHub issueCode Sample, a copy-pastable example
pd.DataFrame(columns=["date", "crew_member_id"])
.groupby(["date", "crew_member_id"], as_index=False)
.sum()
Problem description
With 1.3rc1 this fails with ValueError: Length of values (0) does not match length of index (1)
while 1.2 returns and empty frame.
Expected Output
If this is the expected behavior fine. Just wanted to ensure that it is not an accidental regression.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7 (7 by maintainers)
Top Results From Across the Web
pandas.DataFrame.groupby — pandas 1.5.2 documentation
A groupby operation involves some combination of splitting the object, applying a function, and combining the results. This can be used to group...
Read more >Percent Change In Groupby Object by Group - Stack Overflow
I'd like to add a percent change from previous year to a column to the right in this groupby. I tried several methods,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This one fails too:
The initial code snippet seems a bit artificial to me, mostly because I don’t know what to actually expect. But this one returned
on 1.2.4 which looks sensible to me. Labelling as a regression
Ah - this path is dropping column ‘b’ because it is object dtype. Doing
gives
which is better. Running tests now, PR to follow.