To delete rows from a Python Pandas DataFrame based on a conditional expression, we can use the drop method.
For instance, we write
df = df.drop(df[df.score < 50].index)
to call drop to remove the items from the score column with values less than 50 with
df.drop(df[df.score < 50].index)
and return a new data frame with the removed values.
We can also set the inplace argument to True to do the removal in place:
df.drop(df[df.score < 50].index, inplace=True)