← Quiz: Data Science Basics: all 10 questions
Quiz: Data Science Basics · Question 8 of 10
What does this print? (code)
What does this print?
import pandas as pd
orders = pd.DataFrame({"restaurant": ["A", "B", "A", "B"], "minutes_late": [10, 0, 20, 2]})
print(orders.groupby("restaurant")["minutes_late"].mean().idxmax())
- A.B
- B.A
- C.15.0
- D.minutes_late
Answer & explanation
Correct answer: A
Restaurant A averages 15 minutes late, B averages 1; idxmax returns the label with the largest mean.
Can you get the rest right without peeking?
Take the timed Quiz: Data Science Basics quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →