How to get unique values of a column
df['column_name'].unique()
How to exclude columns with ‘object’ datatype from a pandas DataFrame.
new_df = df.select_dtypes(exclude=['object'])
How to get a list of columns of a certain datatype of a Pandas DataFrame. In this case, the datatype is ‘object’.
object_cols = [col for col in df.columns if df[col].dtype == "object"]
Get list of columns containing missing data and remove the columns from dataframe.
cols_with_missing = [col for col in df.columns if df[col].isnull().any()]
df.drop(cols_with_missing, axis=1, inplace=True)