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