length of dataframe in pandas code example Example 1: length of pandas dataframe df.shape[0] Example 2: df length total_rows = df.count print total_rows +1