@@ -1173,22 +1173,21 @@ def test_rolling_quantile_series(self):
1173
1173
s = Series (arr )
1174
1174
q1 = s .quantile (0.1 )
1175
1175
q2 = s .rolling (100 ).quantile (0.1 ).iloc [- 1 ]
1176
- tm .assert_almost_equal (q1 , q2 )
1177
-
1178
- q1 = s .quantile (0.1 , interpolation = 'lower' )
1179
- q2 = s .rolling (100 ).quantile (0.1 , interpolation = 'lower' ).iloc [- 1 ]
1180
- tm .assert_almost_equal (q1 , q2 )
1181
1176
1182
- q1 = s .quantile (0.1 , interpolation = 'higher' )
1183
- q2 = s .rolling (100 ).quantile (0.1 , interpolation = 'higher' ).iloc [- 1 ]
1184
1177
tm .assert_almost_equal (q1 , q2 )
1185
1178
1186
- q1 = s .quantile (0.1 , interpolation = 'nearest' )
1187
- q2 = s .rolling (100 ).quantile (0.1 , interpolation = 'nearest' ).iloc [- 1 ]
1188
- tm .assert_almost_equal (q1 , q2 )
1179
+ @pytest .mark .parametrize ('quantile' , [0.0 , 0.1 , 0.45 , 0.5 , 1 ])
1180
+ @pytest .mark .parametrize ('interpolation' , ['linear' , 'lower' , 'higher' ,
1181
+ 'nearest' , 'midpoint' ])
1182
+ def test_rolling_quantile_interpolation_options (self , quantile ,
1183
+ interpolation ):
1184
+ # Tests that rolling window's quantile behavior is analogus to
1185
+ # Series' quantile for each interpolation option
1186
+ size = 100
1187
+ s = Series (np .arange (size ))
1188
+ q1 = s .quantile (quantile , interpolation )
1189
+ q2 = s .rolling (size ).quantile (quantile , interpolation ).iloc [- 1 ]
1189
1190
1190
- q1 = s .quantile (0.1 , interpolation = 'midpoint' )
1191
- q2 = s .rolling (100 ).quantile (0.1 , interpolation = 'midpoint' ).iloc [- 1 ]
1192
1191
tm .assert_almost_equal (q1 , q2 )
1193
1192
1194
1193
def test_rolling_quantile_param (self ):
0 commit comments