I am looking to create a function that will accept a pandas dataframe and a specific value(to_drop) which will then remove any row containing the specified value.
For example if I have this dataframe:
d = {'Name': ['John', 'Bill', "Frank"], 'A' : [1, 5, 7], 'B': [2, 0, 6], 'C' : [3, 1, 9]}
df = pd.DataFrame(d)
If the specific value I choose is 0, the function should remove Bill's row returning the rows of John and Frank.
I am trying to use:
def drop_row(df, to_drop):
new_df = df[df.column != to_drop]
return new_df
This is resulting in an attribute error, which I assumed it would because this only works when you are choosing a specific column.
Thank you!