Net-informations.com

Count the number of rows and columns of a Pandas dataframe

You can try different methods to get the number of rows and columns of the dataframe:

  1. len(df)
  2. len(df.index)
  3. df.shape[0]
  4. df[df.columns[0]].count()
  5. df.count()
  6. df.size

First let's create a data frame with values.

Pandas DataFrame row count

Using len()

You can use len() method to find the number of rows in dataFrame.

Or

Using shape[0]

Another method:

Get Pandas DataFrame column count

Using shape[1]

Using len()

Pandas DataFrame column with row count

Total number of rows and column in DataFrame










net-informations.com (C) 2021    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.
SiteMap  | Terms  | About