1. Home
  2. Data Science
  3. Pandas
  4. What does df.dropna() do by default in pandas?

Added 30 Nov -0001

What does df.dropna() do by default in pandas?

  1. Drops columns containing any missing value
  2. Fills missing values with zero
  3. Reports the count of missing values only
  4. Drops rows containing any missing value Correct answer

Correct answer

D. Drops rows containing any missing value

16 views

MCQSEXAM

Explanation

dropna defaults to axis=0, how="any", so any row with at least one NaN is removed, which can quietly shrink a dataset when one sparse column exists. Passing how="all" keeps rows that still have some data, and subset limits the check to chosen columns. Its counterpart fillna replaces nulls instead of removing them, which is usually safer when data is scarce.

Reference

Asked in: NTS, PPSC IT, Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is D? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Pandas MCQs

Practise all Pandas MCQs

Similar MCQs