← Quiz: pandas Basics: all 10 questions
Quiz: pandas Basics · Question 2 of 10
Which filter is correct for CGPA ≥ 7.5 AND no backlogs?
Which filter is correct for CGPA ≥ 7.5 AND no backlogs?
- A.df[df.cgpa >= 7.5 and df.backlogs == 0]
- B.df[(df["cgpa"] >= 7.5) & (df["backlogs"] == 0)]
- C.df[df["cgpa"] >= 7.5 & df["backlogs"] == 0]
- D.df.filter(cgpa>=7.5, backlogs=0)
Answer & explanation
Correct answer: df[(df["cgpa"] >= 7.5) & (df["backlogs"] == 0)]
Use & with brackets around each condition.
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 →