pandas 获取不符合条件的dataframe
pandas 获取不符合条件的dataframe 或将其过滤掉:
df[df["col"].str.contains('this'|'that')==False] >>> df = pd.DataFrame({"A": ["Hello", "this", "World", "apple"]}) >>> df[df['A'].str.contains("Hello|World")==False] A 1 this 3 apple # 多个条件情况下: # df[df["col1"].str.contains('this|that')==False and df["col2"].str.contains('foo|bar')==True]
【Reference】
1、https://blog.csdn.net/chihwei_hsu/article/details/81604455
posted on 2019-06-28 11:41 CuriousZero 阅读(574) 评论(0) 收藏 举报
浙公网安备 33010602011771号