summaryrefslogtreecommitdiff
path: root/numpy/lib/shape_base.py
diff options
context:
space:
mode:
authorJulian Taylor <jtaylor.debian@googlemail.com>2014-03-04 01:08:12 +0100
committerJulian Taylor <jtaylor.debian@googlemail.com>2014-03-04 18:35:49 +0100
commitf6800f561ae3d148a4948512caa5ae23f5f27f78 (patch)
treeca0ee001c6ca6f65c6ef66b6803a1995ea2c2fe0 /numpy/lib/shape_base.py
parentd4c7c3a69a0dc2458c876dd17a15b1a18b179fd8 (diff)
downloadnumpy-f6800f561ae3d148a4948512caa5ae23f5f27f78.tar.gz
DOC: document equivalence of apply_over_axes and tuple axis ufuncs
Diffstat (limited to 'numpy/lib/shape_base.py')
-rw-r--r--numpy/lib/shape_base.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/numpy/lib/shape_base.py b/numpy/lib/shape_base.py
index c299c1976..38b928d57 100644
--- a/numpy/lib/shape_base.py
+++ b/numpy/lib/shape_base.py
@@ -153,6 +153,12 @@ def apply_over_axes(func, a, axes):
apply_along_axis :
Apply a function to 1-D slices of an array along the given axis.
+ Notes
+ ------
+ This function is equivalent to tuple axis arguments to reorderable ufuncs
+ with keepdims=True. Tuple axis arguments to ufuncs have been availabe since
+ version 1.7.0.
+
Examples
--------
>>> a = np.arange(24).reshape(2,3,4)
@@ -172,6 +178,13 @@ def apply_over_axes(func, a, axes):
[ 92],
[124]]])
+ Tuple axis arguments to ufuncs are equivalent:
+
+ >>> np.sum(a, axis=(0,2), keepdims=True)
+ array([[[ 60],
+ [ 92],
+ [124]]])
+
"""
val = asarray(a)
N = a.ndim