Reputation: 1373
df:
Column1 Column2
1 Balneolaeota;
2 Caldiserica;
3 Calditrichaeota;
4 Candidatus Abawacabacteria;
5 candidatus Adlerbacteria;
I want to delete all rows that contain the string "Candidatus" and "candidatus" in the second column.
Any advice?
Upvotes: 1
Views: 47
Reputation: 3752
You can use str.contains
:
df = df[~df['Column2'].str.contains('candidatus', case=False)]
Out[1]:
Column1 Column2
0 1 Balneolaeota
1 2 Caldiserica
2 3 Calditrichaeota
Upvotes: 3