Skip to content

DOC: DataFrame.groupy.agg with a list of tuples #18220

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
tdpetrou opened this issue Nov 10, 2017 · 6 comments
Closed

DOC: DataFrame.groupy.agg with a list of tuples #18220

tdpetrou opened this issue Nov 10, 2017 · 6 comments

Comments

@tdpetrou
Copy link
Contributor

Code Sample, a copy-pastable example if possible

>>> df = pd.DataFrame({'key' : ['a', 'a', 'b', 'b', 'a'],
                       'data' : np.random.randn(5)})

>>> df.groupby('key')['data'].agg([('foo', 'mean')])
          foo
key          
a   -0.944872
b    0.893212

Problem description

I know its deprecated to rename columns with a dictionary of dictionaries in a groupby but a list of tuples also renames columns.

This behavior is not found in the docs. I accidentally discovered this a while back and then saw it again in Python for Data Analysis.

@mroeschke mroeschke added the Bug label Jun 12, 2021
@rhshadrach rhshadrach changed the title DataFrame.groupy renames columns when given a list of tuples - undocumented behavior DOC: DataFrame.groupy.agg with a list of tuples Jul 15, 2023
@rhshadrach rhshadrach added Docs and removed Bug labels Jul 15, 2023
@rhshadrach
Copy link
Member

Confirmed this is tested in test_multiple_functions_tuples_and_non_tuples. The documentation could go in https://pandas.pydata.org/pandas-docs/dev/user_guide/groupby.html#named-aggregation

@Ememobong28
Copy link

take

Ememobong28 added a commit to Ememobong28/pandas that referenced this issue Aug 11, 2023
Added a missing documentation on an existing behavior of aggregation.
Ememobong28 added a commit to Ememobong28/pandas that referenced this issue Aug 17, 2023
Ememobong28 added a commit to Ememobong28/pandas that referenced this issue Aug 17, 2023
@jahn96
Copy link
Contributor

jahn96 commented Jul 18, 2024

@Ememobong28 are you still working on this?

@Ememobong28
Copy link

Ememobong28 commented Jul 18, 2024 via email

@jahn96
Copy link
Contributor

jahn96 commented Jul 18, 2024

take

@jahn96
Copy link
Contributor

jahn96 commented Jul 18, 2024

No im not

On Thu, Jul 18, 2024 at 12:38 PM Jay Ahn @.> wrote: @Ememobong28 https://github.com/Ememobong28 are you still working on this? — Reply to this email directly, view it on GitHub <#18220 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUGCC7ZGJ57UJHJKYDZLQ3TZNAKR7AVCNFSM6AAAAABLDJZ2FKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZXGM4DOMZWHA . You are receiving this because you were mentioned.Message ID: @.>

Okay. will take a stab at this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment