8000 IndexError on apply_along_axis with empty 2D array · Issue #7454 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content
IndexError on apply_along_axis with empty 2D array #7454
Closed
@Wilfred

Description

@Wilfred
In [21]: a = np.empty(shape=(0,0))

In [22]: np.lib.apply_along_axis(sum, 1, a)
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-22-2fcce4e707fd> in <module>()
----> 1 np.lib.apply_along_axis(sum, 1, a)

myvirtualenv/lib/python2.7/site-packages/numpy-1.9.2-py2.7-linux-x86_64.egg/numpy/lib/shape_base.pyc in apply_along_axis(func1d, axis, arr, *args, **kwargs)
     89     outshape = asarray(arr.shape).take(indlist)
     90     i.put(indlist, ind)
---> 91     res = func1d(arr[tuple(i.tolist())], *args, **kwargs)
     92     #  if res is a number, then we have a smaller output array
     93     if isscalar(res):

IndexError: index 0 is out of bounds for axis 0 with size 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0