🎙 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 5 of 10

How do you add a column percent = cgpa × 9.5?

How do you add a column percent = cgpa × 9.5?

  1. A.for i in df: df.percent = i * 9.5
  2. B.df["percent"] = df["cgpa"] * 9.5
  3. C.df.add("percent", cgpa * 9.5)
  4. D.df.append(cgpa * 9.5)
Answer & explanation

Correct answer: df["percent"] = df["cgpa"] * 9.5

Column maths is vectorised — no loop needed.

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 →