python中isin()相反的函数
时间: 2024-04-25 13:22:30 浏览: 271
回答: 在Python中,isin()函数的相反函数不是isnotin(),而是通过在前面加上~来实现。具体来说,可以使用~data\['column'\].isin(values)来获取不在values中的数据。\[1\]在给定的例子中,通过data1\[~data\['a'\].isin(data2\['a'\])\]可以得到表1中不在表2中的数据。\[2\]需要注意的是,当使用isin()函数时,values参数必须与索引或列匹配,否则会出现错误。\[3\]
#### 引用[.reference_title]
- *1* *2* [isin函数及其反函数](https://blog.csdn.net/weixin_43734080/article/details/128361326)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [Python pandas.DataFrame.isin函数方法的使用](https://blog.csdn.net/weixin_39626690/article/details/110758929)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文