raw=True
no longer applies to groupby().rolling() in 1.0.0 · Issue #31754 · pandas-dev/pandas (original) (raw)
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.