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,当然也可以是其他的

posted on 2020-12-22 19:41  小小喽啰  阅读(1381)  评论(0编辑  收藏  举报