summaryrefslogtreecommitdiff
path: root/numpy/lib/shape_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/shape_base.py
parent5f5ccecbfc116284ed8c8d53cd8b203ceef5f7c7 (diff)
downloadnumpy-48783e5ceb7f60c33db81ab72e5024f42b220990.tar.gz
MAINT: replace len(x.shape) with x.ndim
Diffstat (limited to 'numpy/lib/shape_base.py')
-rw-r--r--numpy/lib/shape_base.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/numpy/lib/shape_base.py b/numpy/lib/shape_base.py
index 62798286f..8ebcf04b4 100644
--- a/numpy/lib/shape_base.py
+++ b/numpy/lib/shape_base.py
@@ -390,7 +390,7 @@ def dstack(tup):
def _replace_zero_by_x_arrays(sub_arys):
for i in range(len(sub_arys)):
- if len(_nx.shape(sub_arys[i])) == 0:
+ if _nx.ndim(sub_arys[i]) == 0:
sub_arys[i] = _nx.empty(0, dtype=sub_arys[i].dtype)
elif _nx.sometrue(_nx.equal(_nx.shape(sub_arys[i]), 0)):
sub_arys[i] = _nx.empty(0, dtype=sub_arys[i].dtype)
@@ -577,9 +577,9 @@ def hsplit(ary, indices_or_sections):
[[ 6., 7.]]])]
"""
- if len(_nx.shape(ary)) == 0:
+ if _nx.ndim(ary) == 0:
raise ValueError('hsplit only works on arrays of 1 or more dimensions')
- if len(ary.shape) > 1:
+ if ary.ndim > 1:
return split(ary, indices_or_sections, 1)
else:
return split(ary, indices_or_sections, 0)
@@ -631,7 +631,7 @@ def vsplit(ary, indices_or_sections):
[ 6., 7.]]])]
"""
- if len(_nx.shape(ary)) < 2:
+ if _nx.ndim(ary) < 2:
raise ValueError('vsplit only works on arrays of 2 or more dimensions')
return split(ary, indices_or_sections, 0)
@@ -676,7 +676,7 @@ def dsplit(ary, indices_or_sections):
array([], dtype=float64)]
"""
- if len(_nx.shape(ary)) < 3:
+ if _nx.ndim(ary) < 3:
raise ValueError('dsplit only works on arrays of 3 or more dimensions')
return split(ary, indices_or_sections, 2)