Examples
By default, for each set of duplicated values, the first occurrence is set on False and all others on True:

In [1]:
import numpy as np
import pandas as pd
In [2]:
animals = pd.Series(['dog', 'cow', 'dog', 'cat', 'dog'])
animals.duplicated()
Out[2]:
0    False
1    False
2     True
3    False
4     True
dtype: bool

which is equivalent to

In [3]:
animals.duplicated(keep='first')
Out[3]:
0    False
1    False
2     True
3    False
4     True
dtype: bool

By using ‘last’, the last occurrence of each set of duplicated values is set on False and all others on True:

In [4]:
animals.duplicated(keep='last')
Out[4]:
0     True
1    False
2     True
3    False
4    False
dtype: bool

By setting keep on False, all duplicates are True:

In [5]:
animals.duplicated(keep=False)
Out[5]:
0     True
1    False
2     True
3    False
4     True
dtype: bool