Pandas DataFrame row count in Python

Problem description

How to count rows within pandas DataFrame in Python/

Problem solution

You can use Python's built-in len() function:

count = len(df)

Or you can use the DataFrame.shape property:

count = df.shape[0]