Get Size of the Pandas DataFrame Last Updated : 28 Nov, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report In this article, we will discuss how to get the size of the Pandas Dataframe using Python. Method 1 : Using df.size This will return the size of dataframe i.e. rows*columns Syntax: dataframe.size where, dataframe is the input dataframe Example: Python code to create a student dataframe and display size Python3 # import pandas module import pandas as pd # create a dataframe # with 5 rows and 3 columns data = pd.DataFrame({ 'name': ['sravan', 'ojsawi', 'bobby', 'rohith', 'gnanesh'], 'subjects': ['java', 'php', 'html/css', 'python', 'R'], 'marks': [98, 90, 78, 91, 87] }) # display dataframe print(data) # get the size data.size Output: Method 2 : Using df.shape This function will return the number of rows and columns in the dataframe Syntax: dataframe.shape where, dataframe is the input dataframe Example: Python program to get the shape of the dataframe Python3 # import pandas module import pandas as pd # create a dataframe # with 5 rows and 3 columns data = pd.DataFrame({ 'name': ['sravan', 'ojsawi', 'bobby', 'rohith', 'gnanesh'], 'subjects': ['java', 'php', 'html/css', 'python', 'R'], 'marks': [98, 90, 78, 91, 87] }) # display dataframe print(data) # get the shape data.shape Output: Method 3: Using df.ndim This will return the number of dimensions present in the dataframe. Syntax: data.ndim where, dataframe is the input dataframe Example: Python program to get the dimension of the dataframe Python3 # import pandas module import pandas as pd # create a dataframe # with 5 rows and 3 columns data = pd.DataFrame({ 'name': ['sravan', 'ojsawi', 'bobby', 'rohith', 'gnanesh'], 'subjects': ['java', 'php', 'html/css', 'python', 'R'], 'marks': [98, 90, 78, 91, 87] }) # display dataframe print(data) # get the dimensions data.ndim Output: Comment More infoAdvertise with us Next Article Get Size of the Pandas DataFrame S sravankumar_171fa07058 Follow Improve Article Tags : Python Python-pandas Python pandas-dataFrame pandas-dataframe-program Practice Tags : python Similar Reads Pandas DataFrame take() Method Python is a great tool for data analysis, primarily because of the fantastic ecosystem of data-centric Python packages like Pandas which make analyzing data much easier. Pandas take() function returns elements on the given indices, along an axis. This means that we are not indexing according to actu 3 min read How to Get First Row of Pandas DataFrame? To get the first row of a Pandas Dataframe there are several methods available, each with its own advantages depending on the situation. The most common methods include using .iloc[], .head(), and .loc[]. Let's understand with this example:Pythonimport pandas as pd data = {'Name': ['Alice', 'Bob', ' 4 min read Get the specified row value of a given Pandas DataFrame Pandas DataFrame is a two-dimensional size-mutable, potentially heterogeneous tabular data structure with labeled axes (rows and columns). Now let's see how to get the specified row value of a given DataFrame. We shall be using loc[ ], iloc[ ], and [ ] for a data frame object to select rows and col 2 min read Python | Pandas Dataframe.iat[ ] Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric Python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Pandas iat[] method is used to return data in a dataframe at the passed location. The 2 min read Python | Pandas dataframe.keys() Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Pandas dataframe.keys() function returns the 'info axis' for the pandas object. If the 1 min read Like