-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Fix Rolling where duplicate datetimelike indexes are treated as consecutive rather than equal with closed='left' and closed='neither' #54917
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
Conversation
@@ -466,20 +466,23 @@ def test_groupby_rolling_subset_with_closed(self): | |||
# GH 35549 | |||
df = DataFrame( | |||
{ | |||
"column1": range(6), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modified these two tests as the result would be list of nan values
pandas/_libs/window/indexers.pyx
Outdated
@@ -138,7 +138,12 @@ def calculate_variable_window_bounds( | |||
break | |||
# end bound is previous end | |||
# or current index | |||
elif (index[end[i - 1]] - end_bound) * index_growth_sign <= 0: | |||
elif index[end[i - 1]] == end_bound: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you make a similar test for VariableOffsetWindowIndexer.get_window_bounds
and include a test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Thanks @ihsansecer |
…consecutive rather than equal with closed='left' and closed='neither' (pandas-dev#54917) * Add bugfix for rolling window with nonunique datetimelike index * Run black * Add entry to whatsnew * Fix VariableOffsetWindowIndexer * Simplify change in indexers.pyx * Add test
doc/source/whatsnew/v2.2.0.rst
file if fixing a bug or adding a new feature.