summaryrefslogtreecommitdiff
path: root/numpy/lib/function_base.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2017-02-24 16:46:58 +0000
committerEric Wieser <wieser.eric@gmail.com>2017-02-24 16:46:58 +0000
commit48783e5ceb7f60c33db81ab72e5024f42b220990 (patch)
tree2284b780e521418b0e73fd7283403d3e7e28da50 /numpy/lib/function_base.py
parent5f5ccecbfc116284ed8c8d53cd8b203ceef5f7c7 (diff)
downloadnumpy-48783e5ceb7f60c33db81ab72e5024f42b220990.tar.gz
MAINT: replace len(x.shape) with x.ndim
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)