I have a dataframe and I want to delete all rows where column A is equal to blue and also col B is equal to green.
I though the below should work, but its not the case.
Can anyone see the problem
df=df.loc[~(df['A']=='blue' & df['B']=='green')]
You should separate the two propositions:
df1=df.loc[~(df['A']=='blue') & ~(df['B']=='green')]