1. Home
  2. Data Science
  3. Pandas
  4. What does ser.value_counts(normalize=True, dropna=False)…

Added 30 Nov -0001

What does ser.value_counts(normalize=True, dropna=False) return?

  1. Relative frequencies excluding NaN, so the resulting proportions sum to less than one overall
  2. Boolean flags indicating whether each value is missing, aligned to the original index
  3. Absolute counts per value, excluding NaN, sorted in ascending order of frequency
  4. Relative frequencies per distinct value, including NaN as its own category, summing to 1 Correct answer

Correct answer

D. Relative frequencies per distinct value, including NaN as its own category, summing to 1

16 views

MCQSEXAM

Explanation

value_counts options: normalize=True divides counts by the total to give proportions, and dropna=False counts missing values as their own entry, which matters when the missing rate is the question. The defaults are dropna=True and sort=True, giving descending absolute counts. Because NaN is counted as a category, the returned proportions still sum to 1.

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