>> pdf a b c 0 1 4.0 10 1 2 2.0 20...">

QST: is the new behavior of GroupByRolling in v1.1.0 intended? · Issue #35486 · pandas-dev/pandas (original) (raw)

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 :)