rapidsai/cudf

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

Open

#10.249 geöffnet am 8. Feb. 2022

Auf GitHub ansehen
 (6 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)C++ (735 Forks)batch import
Pythonbugdaskgood first issue

Repository-Metriken

Stars
 (6.000 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 17T 21h) (230 gemergte PRs in 30 T)

Beschreibung

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

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    <NA>
3941     <NA>
29855    <NA>
14616    <NA>
70864    <NA>
Name: x, dtype: float64

Contributor Guide