ndarray arrays

NumPy's ndarray is a homogeneous multidimensional array, where all elements have the same type (dtype). It is stored compactly in memory, which makes it much faster and more economical than a Python list for numerical computation. Its shape, ndim and dtype attributes describe its form.

Example

import numpy as np
a = np.array([[1, 2], [3, 4]])
a.shape  # (2, 2)

Related concepts

The whole glossary