Learn Before
Concept

NumPy n-dimensional array

The n-dimensional array, or ndarray, is the main data structure enabled by the NumPy library. It can be one- or multi-dimensional depending on the parameters passed to np.array(), but it must consist of homogenous (same-type) data. To create a 1D array, pass in a single list of objects, e.g.

np.array([1, 2, 3]).

To create a 2D array, pass in a list of lists, e.g.

np.array([[1, 2, 3], [4, 5, 6]]).

0

1

Updated 2026-05-01

Tags

Data Science