The NumPy multidimensional array object is called
NumPy arrays are typed arrays of a fixed size. NumPy arrays are homogeneous which means they can contain objects of only one type (unlike the Python lists which are heterogeneous and can contain items of different types).
ndarray is made of two parts:
- The data of the array – stored in a contiguous block of memory
- The metadata – which describes the data
NumPy arrays can execute vectorized operations processing a complete array (Python lists use loops and execute operations on each item of the list).
NumPy lists are indexed from 0 (like Python lists).
Creating a NumPy array
import numpy as np a = np.arange(5)
The data type of the array is
int64 since I am using 64 bit Python.
a.dtype #out dtype('int64')