NVIDIA / NVIDIA/cudf

[BUG] Python groupby rolling aggregations return index inconsistent with pandas

Open
#10,249 7 comments 0 reactions 0 assignees View on GitHub
bug dask good first issue Python
Dominant language
C++
Stars
9.8k
Forks
1.1k
Avg merge
3d 6m
Merged PRs (30d)
278

Description

Python groupby rolling aggregations return a single Index that corresponds to the original row position of the element, but in pandas return a MultiIndex that includes both the groupby key(s) and original row position.

This is not currently blocking any behavior with Dask + cuDF, as grouped rolling operations are blocked by #10173

```python
import pandas as pd
import cudf
import numpy as np

df = cudf.datasets.randomdata(nrows=100000)
pdf = df.to_pandas()

print(pdf.groupby(['id']).rolling(window=3).x.mean().head())
print(df.groupby(['id']).rolling(window=3).x.mean().head())
id
879 43605 NaN
881 3941 NaN
882 29855 NaN
884 14616 NaN
70864 NaN
Name: x, dtype: float64
43605
3941
29855
14616
70864
Name: x, dtype: float64
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.