Py学习  »  Python

每次出错时,如何在python中使用where方法?

John Doe • 3 年前 • 1513 次点击  

我想申请一份工作 .where 函数对该数据帧进行过滤,以便按基音类型进行过滤,但每次都会出现错误“数组条件必须与自身形状相同”。以前的任何数据帧都没有这个问题,

included an image of the error

以及

an image of the column in the dataframe

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/129004
文章 [ 1 ]  |  最新文章 3 年前
richardec
Reply   •   1 楼
richardec    3 年前

我不确定是什么 are.equal_to 是的,但这应该对你有用:

fastball = march[march["TaggedPitchType"] == "Fastball"]