In Python, numpy.size() function count the number of elements along a given axis.
Synatx: numpy.size(arr, axis=None)
arr: [array_like] Input data.
axis: [int, optional] Axis(x,y,z) along which the elements(rows or columns) are counted. By default, give the total number of elements in a array
Returns: [int] Return the number of elements along a given axis.
Code #1 :
Code #2 :
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.