How to Determine if each string in a column does not start with a match of a regular expression.
I need to check when a Column does NOT equal a string.
I've found:
pandas.Series.str.match
And it is almost what I need, but I want to get True when the string is NOT a match
CodePudding user response:
You can check with pd.Series.str.startswith
df_sub = df[~df['col'].str.startswith('your str')]
CodePudding user response:
Just negate the mask returned by str.contains
:
~df['col'].str.contains("Your string")