Find the correct statement to check whether the dataframe (df) has missing values or not.
Find the correct statement to check whether the dataframe (df) has missing values or not.
Solution
✅ Correct Option: 3
df.isnull() is the pandas method that checks for missing values. It returns a DataFrame of the same shape as df, with True where a value is missing (NaN or None) and False elsewhere.
To get a count of missing values per column, use df.isnull().sum().
Option 1: pandas has no nan() method on a DataFrame, so this raises an AttributeError.
Option 2: nan.df() reverses the object and method, and nan is not defined here.
Option 4: df['isnull'] looks for a column named "isnull", so it gives a KeyError unless such a column exists.
Related questions:
2025: 22 May Shift 1
2025: 22 May Shift 1