pandas.DataFrame.duplicated

pandas 3.1.1 · DataFrame · method

Mark repeated values or rows with a boolean mask. Use keep=False to mark every member of a duplicate set.

Call syntax

DataFrame.duplicated(subset=None, keep='first')

Run the example

Edit the example and select Run Python to see the result.

Parameters

ParameterRequirementAccepted values and behavior
subset Optional
Positional or keyword
Default None
column label or iterable of labels

Restrict the operation to these labels instead of considering the whole object.

keep Optional
Positional or keyword
Default 'first'
{'first', 'last', False}

Choose which occurrence to retain when values are duplicated or tied.

Returns

Series