🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: pandas Basics: all 10 questions

Quiz: pandas Basics · Question 4 of 10

Which method counts how many students come from each city?

Which method counts how many students come from each city?

  1. A.df["city"].describe()
  2. B.df["city"].value_counts()
  3. C.df["city"].sum()
  4. D.df.count("city")
Answer & explanation

Correct answer: df["city"].value_counts()

value_counts() counts each distinct value.

Can you get the rest right without peeking?

Take the timed Quiz: pandas Basics quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →