In the NumPy with the help of shape() function, we can find the number of rows and columns. In this function, we pass a matrix and it will return row and column number of the matrix.
Return: The number of rows and columns.
[[1 2 3] [4 5 6] [7 8 9]] (3,3)
[[10 11] [12 13] [14 15]] (3,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.