@@ -120,7 +120,9 @@ def test_rolling_properties(self, da) -> None:
120
120
):
121
121
da .rolling (foo = 2 )
122
122
123
- @pytest .mark .parametrize ("name" , ("sum" , "mean" , "std" , "min" , "max" , "median" ))
123
+ @pytest .mark .parametrize (
124
+ "name" , ("sum" , "mean" , "std" , "min" , "max" , "median" , "argmin" , "argmax" )
125
+ )
124
126
@pytest .mark .parametrize ("center" , (True , False , None ))
125
127
@pytest .mark .parametrize ("min_periods" , (1 , None ))
126
128
@pytest .mark .parametrize ("backend" , ["numpy" ], indirect = True )
@@ -133,9 +135,15 @@ def test_rolling_wrapped_bottleneck(
133
135
134
136
func_name = f"move_{ name } "
135
137
actual = getattr (rolling_obj , name )()
138
+ window = 7
136
139
expected = getattr (bn , func_name )(
137
- da .values , window = 7 , axis = 1 , min_count = min_periods
140
+ da .values , window = window , axis = 1 , min_count = min_periods
138
141
)
142
+ # index 0 is at the rightmost edge of the window
143
+ # need to reverse index here
144
+ # see GH #8541
145
+ if func_name in ["move_argmin" , "move_argmax" ]:
146
+ expected = window - 1 - expected
139
147
140
148
# Using assert_allclose because we get tiny (1e-17) differences in numbagg.
141
149
np .testing .assert_allclose (actual .values , expected )
0 commit comments