how to count rows in a dataframe in python code example Example: Returns the number of rows in this DataFrame # Returns the number of rows in this DataFrame df.count() # 2