pandas isin 和not in


查找df 中存在某些字段,可以使用isin,但是没有not in ,我们可以这样实现

# IN
count_df[count_df.reportno.isin(t_reportno)]
 
# NOT IN
count_df[~count_df.reportno.isin(t_reportno)]

其中,t_reportno是list,当然也可以是其他的


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM