Drop columns whose name contains a specific string from pandas DataFrame

Here is one way to do this:

df = df[df.columns.drop(list(df.filter(regex='Test')))]

Leave a Comment