in
newDropList = [9,10,11,12,22,50,51,60,61]
newDB = newDB[newDB[‘groupId’].isin(newDropList)]
直接查询表中...9,10,11,12,22,50,51,60,61]
newDB = newDB[-newDB[‘groupId’].isin(newDropList)]
直接加一个” – ” 号即可
补充知识:pandas条件组合筛选和按范围筛选...要用.isin 而不能用in,用 in以后选出来的值都是True 和False,然后报错:
ValueError: The truth value of a Series is ambiguous....以上这篇pandas 像SQL一样使用WHERE IN查询条件说明就是小编分享给大家的全部内容了,希望能给大家一个参考。