I have a dataframe named df
a b
0 str1 0
1 str2 .8
2 str3 .4
3 str4 .1
I am iterating through this dataframe. (which i know is not the most efficient way).
I want to drop all rows where b>.7
. This is iterating in a loop, so i want to drop from the same dataframe.
The append has syntax like this:
new_df = new_df.append(df[df['a']>.7],ignore_index= 'True')
Can I do something similar with the drop?
df.drop(df[df['a']>.7])
I get the error:
".... not found in axis
"
The expected result is df
as:
a b
0 str1 0
2 str3 .4
3 str4 .1