File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,11 @@ def test_quantile(self, datetime_series):
43
43
with pytest .raises (ValueError , match = msg ):
44
44
datetime_series .quantile (invalid )
45
45
46
+ s = Series (np .random .randn (100 ))
47
+ percentile_array = [- 0.5 , 0.25 , 1.5 ]
48
+ with pytest .raises (ValueError , match = msg ):
49
+ s .quantile (percentile_array )
50
+
46
51
def test_quantile_multi (self , datetime_series ):
47
52
qs = [0.1 , 0.9 ]
48
53
result = datetime_series .quantile (qs )
Original file line number Diff line number Diff line change @@ -329,12 +329,13 @@ def validate_percentile(q: float | Iterable[float]) -> np.ndarray:
329
329
q_arr = np .asarray (q )
330
330
# Don't change this to an f-string. The string formatting
331
331
# is too expensive for cases where we don't need it.
332
- msg = "percentiles should all be in the interval [0, 1]. Try {} instead. "
332
+ msg = "percentiles should all be in the interval [0, 1]"
333
333
if q_arr .ndim == 0 :
334
334
if not 0 <= q_arr <= 1 :
335
- raise ValueError (msg .format (q_arr / 100.0 ))
336
- elif not all (0 <= qs <= 1 for qs in q_arr ):
337
- raise ValueError (msg .format (q_arr / 100.0 ))
335
+ raise ValueError (msg )
336
+ else :
337
+ if not all (0 <= qs <= 1 for qs in q_arr ):
338
+ raise ValueError (msg )
338
339
return q_arr
339
340
340
341
You can’t perform that action at this time.
0 commit comments