Important Notice:

Course Content
NumPy Basic in Python (Chapter-13) M3-R5
About Lesson

ndim:- it display the dimensions of array.

import numpy as np

arr=np.array([[1,2,3,4],[4,5,6,7],[8,9,10,11]])

print(“Total no of dimension= “,arr.ndim)

 

Shape:- it return a tuple of integers indicating the size of the array.

import numpy as np

arr=np.array([[1,2,3,4],[4,5,6,7],[8,9,10,11]])

print(“Shape of Array is= “,arr.shape)

output

Shape of Array is=  (3, 4)

 

Size:- it return the total number of elements in the NumPy array.

import numpy as np

arr=np.array([[1,2,3,4],[4,5,6,7],[8,9,10,11]])

print(“size of Array is= “,arr.size)

output

size of Array is=  12

 

 

error: Content is protected !!