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

原文地址:https://www.cnblogs.com/cgmcoding/p/14174838.html