summaryrefslogtreecommitdiff
path: root/numpy/lib/function_base.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r--numpy/lib/function_base.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index fc49a6fd7..1cf57d617 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:
@@ -1900,7 +1900,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)
@@ -2144,7 +2144,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)
@@ -4488,7 +4488,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)