🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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())
  1. A.B
  2. B.A
  3. C.15.0
  4. 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 →