@@ -1129,16 +1129,6 @@ def test_rolling_quantile_np_percentile(self):
1129
1129
1130
1130
tm .assert_almost_equal (df_quantile .values , np .array (np_percentile ))
1131
1131
1132
- def test_rolling_quantile_series (self ):
1133
- # #16211: Tests that rolling window's quantile default behavior
1134
- # is analogous to Series' quantile
1135
- arr = np .arange (100 )
1136
- s = Series (arr )
1137
- q1 = s .quantile (0.1 )
1138
- q2 = s .rolling (100 ).quantile (0.1 ).iloc [- 1 ]
1139
-
1140
- tm .assert_almost_equal (q1 , q2 )
1141
-
1142
1132
@pytest .mark .skipif (_np_version_under1p12 ,
1143
1133
reason = 'numpy midpoint interpolation is broken' )
1144
1134
@pytest .mark .parametrize ('quantile' , [0.0 , 0.1 , 0.45 , 0.5 , 1 ])
@@ -1149,7 +1139,7 @@ def test_rolling_quantile_series(self):
1149
1139
[0. , np .nan , 0.2 , np .nan , 0.4 ],
1150
1140
[np .nan , np .nan , np .nan , np .nan ],
1151
1141
[np .nan , 0.1 , np .nan , 0.3 , 0.4 , 0.5 ],
1152
- [0.5 ], [np .nan , 0.7 , 0.5 ]])
1142
+ [0.5 ], [np .nan , 0.7 , 0.6 ]])
1153
1143
def test_rolling_quantile_interpolation_options (self , quantile ,
1154
1144
interpolation , data ):
1155
1145
# Tests that rolling window's quantile behavior is analogous to
@@ -1163,13 +1153,13 @@ def test_rolling_quantile_interpolation_options(self, quantile,
1163
1153
if np .isnan (q1 ):
1164
1154
assert np .isnan (q2 )
1165
1155
else :
1166
- assert round ( q1 , 15 ) == round ( q2 , 15 )
1156
+ assert q1 == q2
1167
1157
1168
1158
def test_invalid_quantile_value (self ):
1169
1159
data = np .arange (5 )
1170
1160
s = Series (data )
1171
1161
1172
- with pytest .raises (ValueError , match = "Interpolation invalid"
1162
+ with pytest .raises (ValueError , match = "Interpolation ' invalid' "
1173
1163
" is not supported" ):
1174
1164
s .rolling (len (data ), min_periods = 1 ).quantile (
1175
1165
0.5 , interpolation = 'invalid' )
0 commit comments