Skip to content

raw=True no longer applies to groupby().rolling() in 1.0.0 #31754

Closed
@icexelloss

Description

@icexelloss

Code Sample, a copy-pastable example if possible

df = pd.DataFrame({'id': [1, 1, 1], 'value': [1, 2, 3]})

def foo(x):
    print(type(x))
    return 0.0

When setting raw=True

>>> df.groupby("id").value.rolling(1).apply(foo, raw=True, engine='numba')
<class 'pandas.core.series.Series'>
<class 'pandas.core.series.Series'>
<class 'pandas.core.series.Series'>
id
1   0    0.0
    1    0.0
    2    0.0
Name: value, dtype: float64

>>> df.groupby("id").value.rolling(1).apply(foo, raw=True, engine='cython')
<class 'pandas.core.series.Series'>
<class 'pandas.core.series.Series'>
<class 'pandas.core.series.Series'>
id
1   0    0.0
    1    0.0
    2    0.0
Name: value, dtype: float64

>>> df.groupby("id").value.rolling(1).apply(foo, raw=True)
<class 'pandas.core.series.Series'>
<class 'pandas.core.series.Series'>
<class 'pandas.core.series.Series'>
id
1   0    0.0
    1    0.0
    2    0.0
Name: value, dtype: float64

Problem description

This changes the behavior of raw=True, it seems it no long allows user to pass numpy array to a rolling udf.

Metadata

Metadata

Assignees

Labels

RegressionFunctionality that used to work in a prior pandas versionWindowrolling, ewma, expanding

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions