Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
itholic opened this issue Jul 31, 2020 · 2 comments · Fixed by #35513
Closed

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

itholic opened this issue Jul 31, 2020 · 2 comments · Fixed by #35513
Labels
Groupby Regression Functionality that used to work in a prior pandas version Window rolling, ewma, expanding
Milestone

Comments

@itholic
Copy link

itholic commented Jul 31, 2020

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

@itholic itholic added Needs Triage Issue that has not been reviewed by a pandas team member Usage Question labels Jul 31, 2020
@simonjayhawkins
Copy link
Member

the change in behaviour is from #34052 cc @mroeschke

bad52a9 is the first bad commit
commit bad52a9
Author: Matthew Roeschke [email protected]
Date: Mon May 25 10:26:19 2020 -0700

PERF: Use Indexers to implement groupby rolling (#34052)

@simonjayhawkins simonjayhawkins added Groupby Regression Functionality that used to work in a prior pandas version Window rolling, ewma, expanding and removed Needs Triage Issue that has not been reviewed by a pandas team member Usage Question labels Jul 31, 2020
@simonjayhawkins simonjayhawkins added this to the 1.1.1 milestone Jul 31, 2020
@itholic
Copy link
Author

itholic commented Jul 31, 2020

Thanks, @simonjayhawkins :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Groupby Regression Functionality that used to work in a prior pandas version Window rolling, ewma, expanding
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants