Skip to content

Non-Reducing Return Values in Rolling .apply #4130

Closed
@hayd

Description

@hayd

related #2813, #4964 (somewhat)

At the moment rolling_apply (et al) the passed function has to return a value (unlike apply which can return a Series and overall return a DataFrame).

If you could pass it a Series you could, for example, do this:

from pandas.core.algorithms import value_counts
s = Series([1, 1, 2, 3, 1, 2, 3, 2, 1])

pd.rolling_apply(s, 3, value_counts)

from the mailing list.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ApplyApply, Aggregate, Transform, MapEnhancementWindowrolling, ewma, expanding

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions