I have a dataset that has a column that looks like this:
NAME
ZZKIDS
ZZZKIDS
ZZZANTHONY
To filter the rows, I know I can use this:
df[~df.NAME.str.contains("ZZ")]
Is there a way to add the other "ZZZ" along with "ZZ"?
I have a dataset that has a column that looks like this:
NAME
ZZKIDS
ZZZKIDS
ZZZANTHONY
To filter the rows, I know I can use this:
df[~df.NAME.str.contains("ZZ")]
Is there a way to add the other "ZZZ" along with "ZZ"?
Use the following regex:
df[~df.NAME.str.contains('Z{2,}')]
'Z{2,}'
means 2 or more occurences of Z