Tutorials References Exercises Videos Menu
Create Website Get Certified Upgrade

Pandas DataFrame size Property

❮ DataFrame Reference


Example

Return the number of elements in the DataFrame:

import pandas as pd

df = pd.read_csv('data.csv')

print(df.size)
Try it Yourself »

Definition and Usage

The size property returns the number of elements in the DataFrame.

The number of elements is the number of rows * the number of columns.

In our example the DataFrame has 169 rows and 4 columns: 169 * 4 = 676


Syntax

dataframe.size

Return Value

An Int, representing the number of elements in the DataFrame.


❮ DataFrame Reference