Pandas Print DataFrame Size
The code below provides a sample DataFrame for illustration purposes throughout this article.
The code above should return a DataFrame as shown:
Pandas DataFrame Size Attribute
The size attribute returns the size of a DataFrame or Series. This corresponds to the total number of elements in the DataFrame.
The total number of elements in a DataFrame = rows x columns.
The code below shows how to get the size of the DataFrame provided above.
The above returns the total number of elements in the DataFrame.
To get the number of rows and columns in a tuple format, you can use the shape attribute as shown:
This should return:
This article shows how to get the size of a Pandas DataFrame using the size and shape attributes. Check the docs for more.