Skip to main contentSkip to solution

_________ will display the total number of values for each column or row of a DataFrame.

Solution

✅ Correct Option: 1

count() is the pandas DataFrame method that returns the number of non-null values in each column (default, axis=0) or in each row (axis=1).

For example, df.count() gives one count per column, and df.count(axis=1) gives one count per row.


Options 2 and 3: tail(n) and head(n) display the last n and first n rows of the data. They do not count anything.

Option 4: max() returns the largest value in each column or row, not the number of values.

count() skips NaN (missing) values, so it can be smaller than the total number of rows.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question