How can we get the Shape of an Array?

In NumPy, we will use an attribute called shape which returns a tuple, the elements of the tuple give the lengths of the corresponding array dimensions.

Syntax: numpy.shape(array_name) 

Parameters: Array is passed as a Parameter. 

Return: A tuple whose elements give the lengths of the corresponding array dimensions.

NumPy Array Shape

The shape of an array can be defined as the number of elements in each dimension. Dimension is the number of indices or subscripts, that we require in order to specify an individual element of an array.

Similar Reads

How can we get the Shape of an Array?

In NumPy, we will use an attribute called shape which returns a tuple, the elements of the tuple give the lengths of the corresponding array dimensions....

Shape Manipulation in NumPy

Below are some examples by which we can understand about shape manipulation in NumPy in Python:...

Contact Us