Skip to content

QST: is the new behavior of GroupByRolling in v1.1.0 intended? #35486

Closed
@itholic

Description

@itholic

Question about pandas

Let's say we have a DataFrame like the below.

>>> pdf = pd.DataFrame({"a": [1, 2, 3, 2], "b": [4.0, 2.0, 3.0, 1.0], "c": [10, 20, 30, 20]})
>>> pdf
   a    b   c
0  1  4.0  10
1  2  2.0  20
2  3  3.0  30
3  2  1.0  20

Then, when I use GroupByRolling, In the version of pandas <= 1.0.5 shows result as below.

>>> pdf.groupby('a')[['b']].rolling(2).max()
       b
a
1 0  NaN
3 2  NaN
2 1  NaN
  3  2.0

However, In the pandas 1.1.0, the result seems different from the previous version as below.

>>> pdf.groupby('a')[['b']].rolling(2).max()
       a    b     c
a
1 0  NaN  NaN   NaN
2 1  NaN  NaN   NaN
  3  2.0  2.0  20.0
3 2  NaN  NaN   NaN

Could someone let me know Is it intended? or unexpected behavior (maybe kind of bug) ?

Thanks :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    GroupbyRegressionFunctionality 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