summaryrefslogtreecommitdiff
path: root/numpy/lib/shape_base.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2013-05-04 16:34:04 -0700
committerCharles Harris <charlesr.harris@gmail.com>2013-05-04 16:34:04 -0700
commitdcf7cac3fcaec17f9360f5f32751cd5ca7a61e30 (patch)
treefd84b2a64ade5fdf7d0760872c195801606d7253 /numpy/lib/shape_base.py
parent4c6cfab6c056e641bb0bfc8a31feca2eb7229eb2 (diff)
parente3cd6a48108236cdee681e2de453a8aca1799125 (diff)
downloadnumpy-dcf7cac3fcaec17f9360f5f32751cd5ca7a61e30.tar.gz
Merge pull request #3264 from endolith/patch-1
DOC: Change example to demonstrate function
Diffstat (limited to 'numpy/lib/shape_base.py')
-rw-r--r--numpy/lib/shape_base.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/numpy/lib/shape_base.py b/numpy/lib/shape_base.py
index 5357c62df..e81bae5fc 100644
--- a/numpy/lib/shape_base.py
+++ b/numpy/lib/shape_base.py
@@ -55,14 +55,11 @@ def apply_along_axis(func1d,axis,arr,*args):
For a function that doesn't return a scalar, the number of dimensions in
`outarr` is the same as `arr`.
- >>> def new_func(a):
- ... \"\"\"Divide elements of a by 2.\"\"\"
- ... return a * 0.5
- >>> b = np.array([[1,2,3], [4,5,6], [7,8,9]])
- >>> np.apply_along_axis(new_func, 0, b)
- array([[ 0.5, 1. , 1.5],
- [ 2. , 2.5, 3. ],
- [ 3.5, 4. , 4.5]])
+ >>> b = np.array([[8,1,7], [4,3,9], [5,2,6]])
+ >>> np.apply_along_axis(sorted, 1, b)
+ array([[1, 7, 8],
+ [3, 4, 9],
+ [2, 5, 6]])
"""
arr = asarray(arr)