Question:

What will be the output of df.isnull().any()?

Show Hint

isnull() gives a Boolean table. any() then reduces each column to one Boolean.
Updated On: Oct 1, 2026
  • True if all columns contain null values
  • False if no missing values are present in any column
  • True or false for each column depending whether it contains missing values or not
  • A count for missing values in all columns
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is C

Solution and Explanation

Step 1: Understanding the Concept:
In Pandas, df.isnull() returns a DataFrame of the same shape with True where a value is missing (NaN) and False elsewhere. The method any() then checks each column to see if at least one True is present.

Step 2: Trace the call.
First df.isnull() builds the True/False table. Then .any() works down each column (axis 0 by default) and returns one value per column. The result is a Series indexed by column names.

Step 3: Run an example.
Let a column a hold 1 and NaN, and a column b hold 2 and 3. Then df.isnull().any() prints a True and b False. Column a has a missing value, column b has none. (This was checked by running it in Python.)

Step 4: Check option 1.
A single True for all-null columns would need all() and would give one value per column, not one message. So option 1 is wrong.

Step 5: Check option 2.
False for the whole frame would need another any() to reduce it to one value. Here we get a result per column. So option 2 is wrong.

Step 6: Check option 3.
The result is True or False for each column, depending on whether that column has missing values. So option 3 is correct.

Step 7: Check option 4.
A count of missing values is given by df.isnull().sum(), not any(). So option 4 is wrong.

Final Answer:
The output is True or False for each column, option 3. \[ \boxed{3} \]
Was this answer helpful?
0
0