How do I get the row count of a Pandas DataFrame?
Topic starter 13/07/2021 11:18 am
I'm trying to get the number of rows of DataFrame (df) with Pandas. Can you please help?
13/07/2021 3:11 pm
For a DataFrame
df, one can use any of the following:
count_row = df.shape # Gives number of rows count_col = df.shape # Gives number of columns
- df[df.columns].count() (slowest, but avoids counting NaN values in the first column)