DOK.ndim

DOK.ndim

The number of dimensions of this array.

Returns

The number of dimensions of this array.

Return type

int

See also

DOK.ndim

Equivalent property for DOK arrays.

numpy.ndarray.ndim

Numpy equivalent property.

Examples

>>> from sparse import COO
>>> import numpy as np
>>> x = np.random.rand(1, 2, 3, 1, 2)
>>> s = COO.from_numpy(x)
>>> s.ndim
5
>>> s.ndim == x.ndim
True