1. Home
  2. Data Science
  3. Pandas
  4. What does df.dropna(thresh=3) keep?

Added 30 Nov -0001

What does df.dropna(thresh=3) keep?

  1. Columns containing at least three non-missing values
  2. Rows containing at least three non-missing values Correct answer
  3. Rows containing fewer than three missing values
  4. Rows containing exactly three non-missing values

Correct answer

B. Rows containing at least three non-missing values

14 views

MCQSEXAM

Explanation

thresh is the minimum count of non-NA values required to keep a row or column, so thresh=3 keeps any row with three or more present values and drops the rest. It is the complement of a maximum-missing rule, and the subset argument restricts the count to chosen columns. how='all' and how='any' are the coarser alternatives.

Reference

Asked in: NTS, PPSC IT, Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is B? 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