-
-
Notifications
You must be signed in to change notification settings - Fork 19.1k
CLN: Centralised _check_percentile #27584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
69ef619
715ac7d
de8a4ab
7db44a4
350a624
4b4ca39
79c407d
146ebc5
8807706
b0a02e4
d4d0e88
7870f75
93a7970
5b0122f
946ee3f
3c56c6b
786e172
d81a08d
631a049
f66f314
4e399c6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
intended for public consumption | ||
""" | ||
from textwrap import dedent | ||
from typing import Dict | ||
from typing import Dict, Union, Iterable | ||
from warnings import catch_warnings, simplefilter, warn | ||
|
||
import numpy as np | ||
|
@@ -1105,6 +1105,22 @@ def _get_score(at): | |
return result | ||
|
||
|
||
def check_percentile(q: Union[float, Iterable[float]]) -> np.ndarray: | ||
|
||
""" | ||
Validate percentiles (used by describe and quantile). | ||
hedonhermdev marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
""" | ||
|
||
msg = "percentiles should all be in the interval [0, 1]. " "Try {0} instead." | ||
q = np.asarray(q) | ||
|
||
if q.ndim == 0: | ||
if not 0 <= q <= 1: | ||
raise ValueError(msg.format(q / 100.0)) | ||
else: | ||
if not all(0 <= qs <= 1 for qs in q): | ||
raise ValueError(msg.format(q / 100.0)) | ||
return q | ||
|
||
|
||
# --------------- # | ||
# select n # | ||
# --------------- # | ||
|
Uh oh!
There was an error while loading. Please reload this page.