From f6800f561ae3d148a4948512caa5ae23f5f27f78 Mon Sep 17 00:00:00 2001 From: Julian Taylor Date: Tue, 4 Mar 2014 01:08:12 +0100 Subject: DOC: document equivalence of apply_over_axes and tuple axis ufuncs --- numpy/lib/shape_base.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'numpy/lib/shape_base.py') 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 -- cgit v1.2.1