nditer multi_index gives incorrect value for 0-dim arrays #448

njsmith opened this Issue Sep 18, 2012 · 3 comments


None yet

4 participants

njsmith commented Sep 18, 2012

(From discussion in #445)

In [32]: a
Out[32]: array(0)

In [33]: a.shape
Out[33]: ()

In [34]: i = np.nditer(a, flags=["multi_index"])

In [35]: i.next()
Out[35]: array(0)

In [36]: i.multi_index
Out[36]: (0,)

In [37]: a[i.multi_index]
IndexError: 0-d arrays can only use a single () or a list of newaxes (and a single ...) as an index

The multi_index here should be (), not (0,).

87 commented Sep 19, 2012

See #445 and 3043864 for a (new) fix for this issue.

seberg commented Oct 25, 2013

This has been fixed in master by allowing nditer to be true 0-d.

@seberg seberg closed this Oct 25, 2013

I am still getting the same error (I am using python through Anaconda on my Mac). Can anyone please help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment