diff options
author | Julian Taylor <juliantaylor108@gmail.com> | 2017-02-25 16:39:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-25 16:39:43 +0100 |
commit | eb271d95c0c9f3821009330d858a261b4b861bfe (patch) | |
tree | 4e076b45c91eacce30cdbdc0f3b80cad1118dcdd /numpy/lib/function_base.py | |
parent | e9246860480b6c909e6e00c1cd4371b0e5fee1ce (diff) | |
parent | 38ce8097749ad69494926036250ed5b2de66184c (diff) | |
download | numpy-eb271d95c0c9f3821009330d858a261b4b861bfe.tar.gz |
Merge pull request #8685 from eric-wieser/shape-to-ndim
ENH: add dtype.ndim
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r-- | numpy/lib/function_base.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 95d754403..d01a4a6cd 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -1674,7 +1674,7 @@ def gradient(f, *varargs, **kwargs): S0025-5718-1988-0935077-0/S0025-5718-1988-0935077-0.pdf>`_. """ f = np.asanyarray(f) - N = len(f.shape) # number of dimensions + N = f.ndim # number of dimensions axes = kwargs.pop('axis', None) if axes is None: @@ -1907,7 +1907,7 @@ def diff(a, n=1, axis=-1): raise ValueError( "order must be non-negative but got " + repr(n)) a = asanyarray(a) - nd = len(a.shape) + nd = a.ndim slice1 = [slice(None)]*nd slice2 = [slice(None)]*nd slice1[axis] = slice(1, None) @@ -2151,7 +2151,7 @@ def unwrap(p, discont=pi, axis=-1): """ p = asarray(p) - nd = len(p.shape) + nd = p.ndim dd = diff(p, axis=axis) slice1 = [slice(None, None)]*nd # full slices slice1[axis] = slice(1, None) @@ -4495,7 +4495,7 @@ def trapz(y, x=None, dx=1.0, axis=-1): d = d.reshape(shape) else: d = diff(x, axis=axis) - nd = len(y.shape) + nd = y.ndim slice1 = [slice(None)]*nd slice2 = [slice(None)]*nd slice1[axis] = slice(1, None) |