Skip to content

GroupBy Doesn't Always Maintain Column Index Name #29764

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

Closed
WillAyd opened this issue Nov 21, 2019 · 2 comments · Fixed by #36121
Closed

GroupBy Doesn't Always Maintain Column Index Name #29764

WillAyd opened this issue Nov 21, 2019 · 2 comments · Fixed by #36121
Milestone

Comments

@WillAyd
Copy link
Member

WillAyd commented Nov 21, 2019

Just as a follow up to #29124 discovered during #29753 - looks like the column name is dropped for any/all and transformation functions in groupby

>>> df = pd.DataFrame([[1]], columns=pd.Index(["a"], name="idx"))
>>> df.groupby([1]).sum()
idx  a
1    1
>>> df.groupby([1]).any()
      a
1  True
>>> df.groupby([1]).shift()
    a
0 NaN
@WillAyd WillAyd added this to the Contributions Welcome milestone Nov 21, 2019
@marco-neumann-by
Copy link

Reading through the code example, I think this should be "GroupBy Doesn't Always Maintain Index Name".

@WillAyd WillAyd changed the title GroupBy Doesn't Always Maintain Column Name GroupBy Doesn't Always Maintain Column Index Name Nov 21, 2019
@WillAyd
Copy link
Member Author

WillAyd commented Nov 21, 2019

Thanks! Updated to clarify

phofl added a commit to phofl/pandas that referenced this issue Mar 29, 2020
phofl added a commit to phofl/pandas that referenced this issue Sep 4, 2020
@jreback jreback modified the milestones: Contributions Welcome, 1.2 Sep 5, 2020
@jreback jreback added the Bug label Sep 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants