@@ -1167,16 +1167,6 @@ def test_rolling_quantile_np_percentile(self):
1167
1167
1168
1168
tm .assert_almost_equal (df_quantile .values , np .array (np_percentile ))
1169
1169
1170
- def test_rolling_quantile_series (self ):
1171
- # #16211: Tests that rolling window's quantile default behavior
1172
- # is analogous to Series' quantile
1173
- arr = np .arange (100 )
1174
- s = Series (arr )
1175
- q1 = s .quantile (0.1 )
1176
- q2 = s .rolling (100 ).quantile (0.1 ).iloc [- 1 ]
1177
-
1178
- tm .assert_almost_equal (q1 , q2 )
1179
-
1180
1170
@pytest .mark .skipif (_np_version_under1p12 ,
1181
1171
reason = 'numpy midpoint interpolation is broken' )
1182
1172
@pytest .mark .parametrize ('quantile' , [0.0 , 0.1 , 0.45 , 0.5 , 1 ])
@@ -1187,7 +1177,7 @@ def test_rolling_quantile_series(self):
1187
1177
[0. , np .nan , 0.2 , np .nan , 0.4 ],
1188
1178
[np .nan , np .nan , np .nan , np .nan ],
1189
1179
[np .nan , 0.1 , np .nan , 0.3 , 0.4 , 0.5 ],
1190
- [0.5 ], [np .nan , 0.7 , 0.5 ]])
1180
+ [0.5 ], [np .nan , 0.7 , 0.6 ]])
1191
1181
def test_rolling_quantile_interpolation_options (self , quantile ,
1192
1182
interpolation , data ):
1193
1183
# Tests that rolling window's quantile behavior is analogous to
@@ -1201,13 +1191,13 @@ def test_rolling_quantile_interpolation_options(self, quantile,
1201
1191
if np .isnan (q1 ):
1202
1192
assert np .isnan (q2 )
1203
1193
else :
1204
- assert round ( q1 , 15 ) == round ( q2 , 15 )
1194
+ assert q1 == q2
1205
1195
1206
1196
def test_invalid_quantile_value (self ):
1207
1197
data = np .arange (5 )
1208
1198
s = Series (data )
1209
1199
1210
- with pytest .raises (ValueError , match = "Interpolation invalid"
1200
+ with pytest .raises (ValueError , match = "Interpolation ' invalid' "
1211
1201
" is not supported" ):
1212
1202
s .rolling (len (data ), min_periods = 1 ).quantile (
1213
1203
0.5 , interpolation = 'invalid' )
0 commit comments