Skip to content

Create more precise annotations for DataFrame/Series GroupBy operations (agg, apply, transform) #456

Closed
@gandhis1

Description

@gandhis1

All of these groupby operations take a function that can be a str or a Callable. They should ensure that:

  • The Callable accepts a first parameter that is a DataFrame or Series as applicable
  • The Callable returns the appropriate type - in some cases an Iterable, in other cases either a DataFrame or Series
  • If a str is passed in, it is part of the set of supported functions, which are located here: https://github.com/pandas-dev/pandas/blob/main/pandas/core/groupby/base.py#L60
  • If possible - and this may not be possible today - ensure that args and kwargs parameters are type checked against the passed-in Callable
  • Comprehensive set of tests are needed here, to exercise all variations

I'll start with transform because that is a fairly simple API compared to the others and it is not very commonly used, so the potential impact of more narrow types there has a lower risk of an impactful regression.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions