考试报名
考试报名
考试内容
考试大纲
在线客服
返回顶部

备考刷题,请到

CDA认证小程序

对于以下名为 df 的 DataFrame,要查询 Score 大于 80 且 Passed 为 True 的行,以下哪一写法不正确?
A. df[(df['Score'] > 80) & (df['Passed'])]
B. df.query('Score > 80 and Passed')
C. df[df.Score > 80 & df.Passed]
D. df[(df.Score > 80) & (df.Passed)]
上一题
下一题
收藏
点赞
评论
题目解析
题目评论(0)

在 Pandas 中,条件之间需要用括号包裹,否则会因为优先级导致错误。选项 C 中,df.Score > 80 & df.Passed 缺少括号,会引发错误。