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.
- Number of rows and columns in a Matrix that contain repeated values
- Get the number of rows and number of columns in Pandas Dataframe
- Find maximum values & position in columns and rows of a Dataframe in Pandas
- Python | Adjusting rows and columns of an excel file using openpyxl module
- Count the number of rows and columns of a Pandas dataframe
- Count the number of rows and columns of Pandas dataframe
- Find duplicate rows in a Dataframe based on all or selected columns
- Python | Delete rows/columns from DataFrame using Pandas.drop()
- Select Rows & Columns by Name or Index in Pandas DataFrame using [ ], loc & iloc
- Dealing with Rows and Columns in Pandas DataFrame
- Iterating over rows and columns in Pandas DataFrame
- How to create an empty DataFrame and append rows & columns to it in Pandas?
- Drop rows from Pandas dataframe with missing values or NaN in columns
- Apply a function to single or selected columns or rows in Pandas Dataframe
- Sort rows or columns in Pandas Dataframe based on values
- Get minimum values in rows or columns with their index position in Pandas-Dataframe
- How to rearrange columns of a 2D NumPy array using given index positions?
- How to swap columns of a given NumPy array?
- Python | Print unique rows in a given boolean matrix using Set with tuples
- Find unique rows in a NumPy array
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.