_________ will display the total number of values for each column or row of a DataFrame.
_________ will display the total number of values for each column or row of a DataFrame.
Solution
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.
Related questions:
2025: 16 May Shift 1
2025: 27 May Shift 2
2025: 30 May Shift 2
2025: 13 May Shift 2
2026: 24 May Shift 1