diff options
author | Maximilian Trescher <maximilian@trescherpost.de> | 2015-08-28 11:12:01 +0200 |
---|---|---|
committer | Maximilian Trescher <maximilian@trescherpost.de> | 2015-09-06 14:42:14 +0200 |
commit | bc1990e770966535d188785cafaa3230c0a0377e (patch) | |
tree | f3babc746e207ab7f911867dcd2392d8af50306d /numpy/lib/function_base.py | |
parent | 2b7fff08567fd1e06df66b8ad2b71959dee63070 (diff) | |
download | numpy-bc1990e770966535d188785cafaa3230c0a0377e.tar.gz |
ENH: gradient takes axis keyword, added release note comment
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r-- | numpy/lib/function_base.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 5bd7cd8b5..007ff42a4 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -1138,10 +1138,12 @@ def gradient(f, *varargs, **kwargs): The default (axis = None) is to calculate the gradient for all the axes of the input array. axis may be negative, in which case it counts from the last to the first axis. + .. versionadded:: 1.11.0 + Returns ------- gradient : list of ndarray - Each element of `list` has the same shape as `f` giving the derivative + Each element of `list` has the same shape as `f` giving the derivative of `f` with respect to each dimension. Examples @@ -1152,10 +1154,10 @@ def gradient(f, *varargs, **kwargs): >>> np.gradient(x, 2) array([ 0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) - For two dimensional arrays, the return will be two arrays ordered by - axis. In this example the first array stands for the gradient in + For two dimensional arrays, the return will be two arrays ordered by + axis. In this example the first array stands for the gradient in rows and the second one in columns direction: - + >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=np.float)) [array([[ 2., 2., -1.], [ 2., 2., -1.]]), array([[ 1. , 2.5, 4. ], |