bigframes.pandas.Series.duplicated#
- Series.duplicated(keep: str = 'first') Series[source]#
Indicate duplicate Series values.
Duplicated values are indicated as
Truevalues in the resulting Series. Either all duplicates, all except the first or all except the last occurrence of duplicates can be indicated.Examples:
>>> import bigframes.pandas as bpd
By default, for each set of duplicated values, the first occurrence is set on False and all others on True:
>>> animals = bpd.Series(['llama', 'cow', 'llama', 'beetle', 'llama']) >>> animals.duplicated() 0 False 1 False 2 True 3 False 4 True dtype: boolean
which is equivalent to
>>> animals.duplicated(keep='first') 0 False 1 False 2 True 3 False 4 True dtype: boolean
By using ‘last’, the last occurrence of each set of duplicated values is set on False and all others on True:
>>> animals.duplicated(keep='last') 0 True 1 False 2 True 3 False 4 False dtype: boolean
By setting keep on False, all duplicates are True:
>>> animals.duplicated(keep=False) 0 True 1 False 2 True 3 False 4 True dtype: boolean
- Parameters:
keep ({'first', 'last', False}, default 'first') –
Method to handle dropping duplicates:
’first’ : Mark duplicates as
Trueexcept for the first occurrence. ‘last’ : Mark duplicates asTrueexcept for the last occurrence.False: Mark all duplicates asTrue.- Returns:
Series indicating whether each value has occurred in the preceding values.
- Return type: