Skip to content

Commit f21d21a

Browse files
committed
Remove redundant test. Place interpolation in single quotes
1 parent 2ac734c commit f21d21a

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

pandas/_libs/window.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1398,7 +1398,7 @@ def roll_quantile(ndarray[float64_t, cast=True] input, int64_t win,
13981398
try:
13991399
interpolation_type = interpolation_types[interpolation]
14001400
except KeyError:
1401-
raise ValueError("Interpolation {} is not supported"
1401+
raise ValueError("Interpolation '{}' is not supported"
14021402
.format(interpolation))
14031403

14041404
# we use the Fixed/Variable Indexer here as the

pandas/tests/test_window.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,16 +1167,6 @@ def test_rolling_quantile_np_percentile(self):
11671167

11681168
tm.assert_almost_equal(df_quantile.values, np.array(np_percentile))
11691169

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-
11801170
@pytest.mark.skipif(_np_version_under1p12,
11811171
reason='numpy midpoint interpolation is broken')
11821172
@pytest.mark.parametrize('quantile', [0.0, 0.1, 0.45, 0.5, 1])
@@ -1187,7 +1177,7 @@ def test_rolling_quantile_series(self):
11871177
[0., np.nan, 0.2, np.nan, 0.4],
11881178
[np.nan, np.nan, np.nan, np.nan],
11891179
[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]])
11911181
def test_rolling_quantile_interpolation_options(self, quantile,
11921182
interpolation, data):
11931183
# Tests that rolling window's quantile behavior is analogous to
@@ -1201,13 +1191,13 @@ def test_rolling_quantile_interpolation_options(self, quantile,
12011191
if np.isnan(q1):
12021192
assert np.isnan(q2)
12031193
else:
1204-
assert round(q1, 15) == round(q2, 15)
1194+
assert q1 == q2
12051195

12061196
def test_invalid_quantile_value(self):
12071197
data = np.arange(5)
12081198
s = Series(data)
12091199

1210-
with pytest.raises(ValueError, match="Interpolation invalid"
1200+
with pytest.raises(ValueError, match="Interpolation 'invalid'"
12111201
" is not supported"):
12121202
s.rolling(len(data), min_periods=1).quantile(
12131203
0.5, interpolation='invalid')

0 commit comments

Comments
 (0)