The following code will select observations from a pandas dataframe that include the word Elstar in the type column.
df[df['type'].str.contains('Elstar')
How should this code be edited so it excludes those that contain the word Elstar? I tried adding a ~ in front of the filter however this does not have the desired effect, as it results in:
TypeError: bad operand type for unary ~: 'float'
I have found solutions where the string should not match an exact other string but in my case part of the value should not match.