Is there a faster way to drop columns that only contain one distinct value than the code below? cols=df.columns.tolist() for col in cols: if len(set(df[col].tolist()))<2: df=df.drop(col, axis=1) This is really quite slow for large dataframes. Logically, this counts the number of values in each column when in fact it could just stop counting after reaching 2 different values. Continue reading...