cudf.Index.duplicated#

Index.duplicated(keep='first') cupy.ndarray[source]#

Indicate duplicate index values.

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

Parameters:
keep{‘first’, ‘last’, False}, default ‘first’

The value or values in a set of duplicates to mark as missing.

  • '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.

Returns:
cupy.ndarray[bool]

See also

Series.duplicated

Equivalent method on cudf.Series.

DataFrame.duplicated

Equivalent method on cudf.DataFrame.

Index.drop_duplicates

Remove duplicate values from Index.

Examples

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

>>> import cudf
>>> idx = cudf.Index(['lama', 'cow', 'lama', 'beetle', 'lama'])
>>> idx.duplicated()
array([False, False,  True, False,  True])

which is equivalent to

>>> idx.duplicated(keep='first')
array([False, False,  True, False,  True])

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

>>> idx.duplicated(keep='last')
array([ True, False,  True, False, False])

By setting keep to False, all duplicates are True:

>>> idx.duplicated(keep=False)
array([ True, False,  True, False,  True])