NumPy’s main object is a multidimensional array of variables that are all the same type and is a table of elements which are typically numbers that are indexed by a tuple of positive integers. Dimensions are called *axes* and the number of *axes *is a *rank. *

For instance if there is a one dimensional array of three elements that array has a rank of one and length three because there is one axis and three elements. If there is a two dimensional array that array has rank two.

NumPy’s class is called **ndarray** and is also known by the alias **array. **

Important attributes of **ndarray** object:

**ndarray.ndim** – number of axes (dimensions) of the array (dimensions are known as rank)

**ndarray.shape** – dimensions of the array; a tuple of integers indicating the size of the array in each dimension. For a matrix with n rows and m columns, shape will be (n,m). The length of the shape tuple is therefore the rank or number of dimensions, ndim.

**ndarray.size** – total number of elements in the array and is equal to the product of the elements of the shape.

**ndarray.dtype** – describes the type of elements (all homogeneous) in the array.

**ndarray.itemsize** – the size of bytes of each element of the array.

**This article is written for Python 3.6

**Numpy Arrays >>**

### Like this:

Like Loading...