Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Add masked support for rolling operations #50449

Open
1 of 3 tasks
bollard opened this issue Dec 27, 2022 · 1 comment
Open
1 of 3 tasks

ENH: Add masked support for rolling operations #50449

bollard opened this issue Dec 27, 2022 · 1 comment
Labels
Enhancement ExtensionArray Extending pandas with custom dtypes or arrays. NA - MaskedArrays Related to pd.NA and nullable extension arrays Window rolling, ewma, expanding

Comments

@bollard
Copy link

bollard commented Dec 27, 2022

Feature Type

  • Adding new functionality to pandas

  • Changing existing functionality in pandas

  • Removing existing functionality in pandas

Problem Description

As per #50399, pandas does not currently support extension arrays in rolling operations

Feature Description

import pandas as pd

ser = pd.Series([i / 10 for i in range(1, 20)]).astype(pd.Float64Dtype())
ser.rolling(2).mean().dtype # dtype('float64') currently, pd.Float64Dtype() ideally

Alternative Solutions

Continue to rely on numpy types

Additional Context

#50399

@bollard bollard added Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels Dec 27, 2022
@rhshadrach rhshadrach added ExtensionArray Extending pandas with custom dtypes or arrays. Window rolling, ewma, expanding and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Dec 27, 2022
@phofl phofl added the NA - MaskedArrays Related to pd.NA and nullable extension arrays label Dec 27, 2022
@ihsansecer
Copy link
Contributor

Looks like this can be done by implementing a _rolling_op function in BaseMaskedArray similar to _groupby_op. Interested in working on this if you are happy to take a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ExtensionArray Extending pandas with custom dtypes or arrays. NA - MaskedArrays Related to pd.NA and nullable extension arrays Window rolling, ewma, expanding
Projects
None yet
Development

No branches or pull requests

4 participants