我想在数据框上应用多个行过滤器。 下面是数据框的外观:
base.html
这是我为数据框编写的代码:
Issue Type Status Orac
0 Risk Event Closed - Actions Completed Orac
1 Conformance Testing Open Orac
2 Risk Event Draft Orac
3 Risk Event Open Orac
4 Risk Event Closed - Actions Completed Orac
现在,我要过滤(“经验教训”,“其他问题”,“风险事件”)中的问题类型和(“打开”中的状态, “打开-已完成操作”)
我收到此错误:
中的第16行xl = pd.ExcelFile(file)
df = xl.parse('Detailed Issue List Report by O')
dfo = df({'Issue Type':['Lessons Learnt','Other Control Issues']},
{'Status':['Open','Open - Actions Completed']})
df1 = dfo[['Issue Type', 'Status']]
df1['Orac'] = pd.Series('Orac', index=df1.index)
在此行:
dfo = df({'Issue Type':['Lessons Learnt','Other Control Issues']})
builtins.TypeError: 'DataFrame' object is not callable
请协助。
非常感谢
答案 0 :(得分:0)
使用称为pandas
的{{1}}方法可以轻松实现这一目标:
.loc
编辑:您的错误是因为您试图调用不是函数的df()