How to usedf.size in Python Pandas
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:
Get Size of the Pandas DataFrame
In this article, we will discuss how to get the size of the Pandas Dataframe using Python.