pandas.Series.drop_duplicates

pandas 3.1.1 · Series and accessors · method

Keep one occurrence of duplicate values or rows by default. Use keep to choose which occurrences survive.

Call syntax

Series.drop_duplicates(*, keep='first', inplace=…, ignore_index=False)

Run the example

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

Parameters

ParameterRequirementAccepted values and behavior
keep Optional
Keyword only
Default 'first'
{'first', 'last', False}

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

inplace Optional
Keyword only
bool

Choose whether to change the existing object. Where supported, an in-place call typically returns None.

ignore_index Optional
Keyword only
Default False
bool

Give the resulting axis new integer labels where supported.

Returns

Series or None