pandas see unique values in column code example
Example 1: how to get distinct value in a column dataframe in python
df.column.unique()
Example 2: pandas unique values in column
df.name.unique()
Example 3: pandas count the number of unique values in a column
df['hID'].nunique()
5
Example 4: pandas unique values to list
df.groupby('param')['column'].nunique().sort_values(ascending=False).unique().tolist()
Example 5: 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()