Allow .expanding() to be called on groupby object · Issue #12738 · pandas-dev/pandas (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Description
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()