summaryrefslogtreecommitdiff
path: root/numpy/lib/shape_base.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/lib/shape_base.py')
-rw-r--r--numpy/lib/shape_base.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/numpy/lib/shape_base.py b/numpy/lib/shape_base.py
index da0b6a5b2..58e13533b 100644
--- a/numpy/lib/shape_base.py
+++ b/numpy/lib/shape_base.py
@@ -109,7 +109,10 @@ def apply_along_axis(func1d, axis, arr, *args, **kwargs):
inds = ndindex(inarr_view.shape[:-1])
# invoke the function on the first item
- ind0 = next(inds)
+ try:
+ ind0 = next(inds)
+ except StopIteration:
+ raise ValueError('Cannot apply_along_axis when any iteration dimensions are 0')
res = asanyarray(func1d(inarr_view[ind0], *args, **kwargs))
# build a buffer for storing evaluations of func1d.