how to unique values in python for all columns code example
Example 1: dataframe unique values in each column
for col in df:
print(df[col].unique())
Example 2: if df[col].unique()==2
df_dict = dict(zip([i for i in df.columns] , [pd.DataFrame(df[i].unique(), columns=[i]) for i in df.columns]))