← 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?
- A.df["city"].describe()
- B.df["city"].value_counts()
- C.df["city"].sum()
- 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 →