Pandas Series: duplicated() function

Indicate duplicate Series values

The duplicated() function is used to indicate duplicate Series values.

Duplicated values are indicated as True values in the resulting Series. Either all duplicates, all except the first or all except the last occurrence of duplicates can be indicated.


Series.duplicated(self, keep='first')
Pandas Series duplicated image


Name Description Type/Default Value Required / Optional
  • ‘first’ : Mark duplicates as True except for the first occurrence.
  • ‘last’ : Mark duplicates as True except for the last occurrence.
  • False : Mark all duplicates as True.
{‘first’, ‘last’, False},
Default Value: ‘first’

Returns: Series indicating whether each value has occurred in the preceding values.


Download the Pandas Series Notebooks from here.

Previous: Remove Pandas series with duplicate values
Next: Test Pandas objects contain the same elements

Share this Tutorial / Exercise on : Facebook and Twitter