The entire scientific computing functionality of NumPy and SciPy is built around two basic types of objects in NumPy. The first object is an n-dimensional array object known as
ndarray, and the second object is a universal function object called ufunc
. Besides these two objects, there are a number of other objects built on top of them.
The ndarray object is a homogenous collection of elements that are indexed using N integers, where N is the dimension of the array. There are two important attributes of ndarray. The first is the data type of the elements of the array, called dtype
, and the second is the shape of the array. The data type here can be any data type supported by Python. The shape of the arrays is an N-tuple, that is, a collection of N elements for the N-dimensional array, where each element of the tuple defines the number of elements in that dimension of the array.