python - Pandas: How to delete string with some value -
i have df
subdomain search_engine search_term 0 vk.com none none 1 vk.com none none 2 facebook.com none none 3 vk.com none none 4 vk.com none vkontakte
i need 4 vk.com none vkontakte
i try
df[~df.search_term.str == r"none"]
but returns typeerror: bad operand type unary ~: 'stringmethods'
i think should it:
in[75]:df[df.search_term.str.strip()!='none'] out[75]: subdomain search_engine search_term 4 vk.com none vkontakte
or work:
df[~df.search_term.str.match('none')]
Comments
Post a Comment