I have some erroneous data points in my dataset that I need to get rid of (see image, it's very obvious there). So I need to drop rows based on dual condition - when column A is greater or equal 0.5 AND column B equals to 0.
So I tried:
df = df.drop(df[df['A'] >= 0.5 & df['B'] == 0].index, inplace=True)
This results in an error:
cannot compare a dtyped [float64] array with a scalar of type [bool]
I then tried to create a mask and drop rows this way:
mask = (df['A'] >= 0.5) & (df['B'] == 0)
df = df.drop(df[mask], axis = 1)
This for some reason results in all my data getting deleted save for the index column.
How do I do this properly? Thanks in advance!