Unique values in a column

In [1]:
import pandas as pd

Get a suitable data set and put it in a DataFrame.

In [2]:
from sklearn.datasets import load_boston
boston = load_boston()
df = pd.DataFrame(boston.data, columns=boston['feature_names'])

Get the unique values in a column.

In [19]:
df['CHAS'].unique()
Out[19]:
array([ 0.,  1.])

See how many entries with each value.

In [20]:
df['CHAS'].value_counts()
Out[20]:
0.0    471
1.0     35
Name: CHAS, dtype: int64