summaryrefslogtreecommitdiff
path: root/numpy/lib/function_base.py
diff options
context:
space:
mode:
authorRalf Gommers <ralf.gommers@googlemail.com>2011-04-29 19:23:59 +0200
committerRalf Gommers <ralf.gommers@googlemail.com>2011-04-29 19:26:37 +0200
commit5aa360321321c69d8052ef0718721baae3587900 (patch)
tree3257796370674f070884cbbf0f63dc4602f82711 /numpy/lib/function_base.py
parent99924798b0683a14d96d8db3430babc0a70fd52e (diff)
downloadnumpy-5aa360321321c69d8052ef0718721baae3587900.tar.gz
DOC:BUG: fix percentile examples. Closes #1813.
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r--numpy/lib/function_base.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index df579a539..87052592c 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -2991,28 +2991,27 @@ def percentile(a, q, axis=None, out=None, overwrite_input=False):
>>> a
array([[10, 7, 4],
[ 3, 2, 1]])
- >>> np.percentile(a, 0.5)
+ >>> np.percentile(a, 50)
3.5
>>> np.percentile(a, 0.5, axis=0)
array([ 6.5, 4.5, 2.5])
- >>> np.percentile(a, 0.5, axis=1)
+ >>> np.percentile(a, 50, axis=1)
array([ 7., 2.])
- >>> m = np.percentile(a, 0.5, axis=0)
+ >>> m = np.percentile(a, 50, axis=0)
>>> out = np.zeros_like(m)
- >>> np.percentile(a, 0.5, axis=0, out=m)
+ >>> np.percentile(a, 50, axis=0, out=m)
array([ 6.5, 4.5, 2.5])
>>> m
array([ 6.5, 4.5, 2.5])
>>> b = a.copy()
- >>> np.percentile(b, 0.5, axis=1, overwrite_input=True)
+ >>> np.percentile(b, 50, axis=1, overwrite_input=True)
array([ 7., 2.])
>>> assert not np.all(a==b)
>>> b = a.copy()
- >>> np.percentile(b, 0.5, axis=None, overwrite_input=True)
+ >>> np.percentile(b, 50, axis=None, overwrite_input=True)
3.5
- >>> assert not np.all(a==b)
"""
a = np.asarray(a)