Version 3 (modified by sasha, 7 years ago)

--

Zero-Rank Arrays

Zero-rank arrays are array with shape=(). For example:

>>> x = array(1)
>>> x.shape
()

Indexing of Zero-Rank Arrays

As of NumPy release 0.9.3, zero-rank arrays do not support any indexing

>>> x[...]
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
IndexError: 0-d arrays can't be indexed.

On the other hand there are several cases that make sense for rank-zero arrays.

Ellipsis and empty tuple

Increasing rank with newaxis