const_cols = [c for c in train_df.columns if train_df[c].nunique(dropna=False) == 1] 这里的train_df 即为待查找的dataframe