标签: pandas
我正在尝试使用以下几个值过滤数据框:
df_new = df[[['bill_no']].isin('1002','1005')]
这会引发错误
AttributeError: 'list' object has no attribute 'isin'
答案 0 :(得分:1)
您需要按列df['bill_no']中的值['1002','1005']进行过滤:
df['bill_no']
['1002','1005']
df_new = df[df['bill_no'].isin(['1002','1005'])]