To find the total number of NaN values in each column, we use _____.
To find the total number of NaN values in each column, we use _____.
Solution
✅ Correct Option: 3
isnull() returns a DataFrame of True/False values, where True marks a NaN. sum() then adds these column-wise, and since True counts as 1, the result is the number of NaN values in each column, as in df.isnull().sum().
Options 1 and 4: count() counts non-null entries. After isnull() every cell is a True or False value, so it just returns the number of rows for every column.
Options 2 and 4: pandas has no isNaN() method. The correct names are isnull() or isna().
Related questions:
2025: 16 May Shift 1
2025: 15 May Shift 2
2026: 11 May Shift 2
2025: 14 May Shift 1
2026: 29 May Shift 2