I have some a df with bridge data where in certain columns the string "(R)" is in. I want to remove those rows if "Blabla (R)" or "hello (R)" is the value. (so something with str.contains)
As in the picture, i want to drop row 9. (and many more)
Why is this error given and how to fix this?
If you would like to remove any rows where the road
field in the df
dataframe equals (S)
, then you can use the following code. This will remove these rows within the same dataframe (df)
df.drop(index=df[df['road'] == '(R)'].index, inplace=True)