Skip to content

Allow .expanding() to be called on groupby object #12738

Closed
@lminer

Description

@lminer

Right now when I want to have expanding operate at the level of a group I have to apply a convenience function like so:

def expanding_sum(s):
    return s.expanding().sum()

expanded_sum = df.groupby('mygroup')['mynum'].apply(expanding_sum)

Would be nice to be able to call a method directly on a groupby object:

expanded_sum = df.groupby('mygroup')['mynum'].expanding().sum()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions