I have the following pandas dataframe and I would like to drop any column that has 0-Flat in the "Trade" row. How would I go about doing that?
>Solution :
This should do the job
headers_to_drop=[header for header in df.columns if (df[header]=="0-Flat").any()]
df=df.drop(headers_to_drop,axis=1)
The code first loops over all the columns and checks if there is any columns with the string and drops the selected columns.
