Skip to main contentSkip to solution

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.

Keyboard Shortcuts

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