如果pandas中的条件有错误

时间:2016-09-29 16:01:51

标签: python pandas

我有一个连接的数据帧。我正在遍历数据帧的行以获取具有特定if条件的该行的值,如下所示。

selected=[]


for index,row in dfs.iterrows():

    if [(row[:,'Panning'][row[:,'Panning']=='Panning']) & (index==0)]:

                selected.append(row[:,'Panning'][row[:,'Panning']=='Panning'].index.tolist())
print selected

当我执行代码时,如果条件

,我会收到错误

TypeError:无法将dtyped [object]数组与[bool]类型的标量进行比较

0 个答案:

没有答案