read comlumns in pandas unique code example
Example 1: count unique pandas
df['column'].nunique()
Example 2: pandas count unique values in column
df.nunique()
Example 3: 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]))
Example 4: unique entries in column pandas
import pandas as pd
pd.set_option('display.max_row', 1000)
pd.set_option('display.max_columns', 50)
data = {'name': ['Jason', 'Molly', 'Tina', 'Jake', 'Amy'],
'year': [2012, 2012, 2013, 2014, 2014],
'reports': [4, 24, 31, 2, 3]}
df = pd.DataFrame(data, index = ['Cochice', 'Pima', 'Santa Cruz', 'Maricopa', 'Yuma'])
df
df.name.unique()