summaryrefslogtreecommitdiff
path: root/numpy/lib
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-30 19:44:32 +0200
commit215c97ec7cd8b0350dd52bc5acbf993350586c53 (patch)
tree8e96ccdbc36b89538d508d32099be0b3ab63f5ef /numpy/lib
parent64f6f0dba0f35abec5cfd42532c3a4c016ea70ee (diff)
downloadnumpy-215c97ec7cd8b0350dd52bc5acbf993350586c53.tar.gz
DOC:BUG: fix percentile examples. Closes #1813.
Diffstat (limited to 'numpy/lib')
-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 a758d6737..ca291f6bb 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -3009,28 +3009,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)