summaryrefslogtreecommitdiff
path: root/numpy/lib/shape_base.py
diff options
context:
space:
mode:
authorendolith <endolith@gmail.com>2013-04-19 22:37:01 -0300
committerendolith <endolith@gmail.com>2013-04-19 22:37:01 -0300
commite3cd6a48108236cdee681e2de453a8aca1799125 (patch)
tree7706283d2ec4d76e197a794627a9dab710e3cb3e /numpy/lib/shape_base.py
parent1975606394d577421c4b4e21abb8fdadbdc572c0 (diff)
downloadnumpy-e3cd6a48108236cdee681e2de453a8aca1799125.tar.gz
DOC: Change example to demonstrate function
"a * 0.5" example might as well be new_func(a) directly, it doesn't demonstrate the purpose of apply_along_axis().
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 de8606167..aa9661cae 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)