My df has 3 columns
df = pd.DataFrame({"col_1": (0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0),
"col_2": (0.0, 0.24, 1.0, 0.0, 0.22, 3.11, 0.0),
"col_3": ("Mon", "Tue", "Thu", "Fri", "Mon", "Tue", "Thu")})
I want to drop rows where df.col_1 is 1.0 and df.col_2 is 0.0. So, I would get:
df = pd.DataFrame({"col_1": (0.0, 0.0, 1.0, 0.0, 1.0),
"col_2": (0.0, 0.24, 1.0, 0.22, 3.11),
"col_3": ("Mon", "Tue", "Thu", "Mon", "Tue")})
I tried:
df_new = df.drop[df[(df['col_1'] == 1.0) & (df['col_2'] == 0.0)].index]
It gives me the error:
'method' object is not subscriptable
Any idea how to solve the above problem?