Skip to content

DOC: Signature information for groupby.aggregate does not include Named Aggregation #47974

Closed
@DRudel

Description

@DRudel

Pandas version checks

  • I have checked that the issue still exists on the latest versions of the docs on main here

Location of the documentation

https://pandas.pydata.org/docs/dev/reference/api/pandas.core.groupby.DataFrameGroupBy.aggregate.html?highlight=aggregate#pandas.core.groupby.DataFrameGroupBy.aggregate

Documentation problem

The entry for Groupby.Aggregate() describes Named Aggregation at the bottom of its entry, but this support is now exposed in the signature information defining the inputs at the top of the page. Also, I would claim that the description for **kwargs is now outdated, for **kwargs now serves a different role when func is None.

Notably, someone looking at signature information would think that Aggregate() and Transform() can take the same types of input, but that is not true, since Transform() does not support Named Aggregation.

Suggested fix for documentation

  • Add a note to the func signature description indicating that when func == None, the Named Aggregation is assumed (with a reference to the User Guide page)
  • Update the **kwargs signature to indicate that when func == None, the keywords are not passed along to the function but are used to define the Named Aggregation

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions