← 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?
- A.for i in df: df.percent = i * 9.5
- B.df["percent"] = df["cgpa"] * 9.5
- C.df.add("percent", cgpa * 9.5)
- 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 →