Let's say I have a DataFrame with the following columns: TAG
, ALIAS
, COMMENT
, TYPE
.
Is there a way to drop all columns that are not COMMENT
without having to type the following line?
df.drop(["TAG","ALIAS","TYPE"], 1)
Is there a way to type an if statement somewhere in there and drop anything that is not the column call e.g., COMMENT
?