bigframes.pandas.MultiIndex.drop_duplicates#
- MultiIndex.drop_duplicates(*, keep: __builtins__.str = 'first') Index#
Return Index with duplicate values removed.
Examples:
>>> import bigframes.pandas as bpd
Generate an pandas.Index with duplicate values.
>>> idx = bpd.Index(['lama', 'cow', 'lama', 'beetle', 'lama', 'hippo'])
The keep parameter controls which duplicate values are removed. The value
firstkeeps the first occurrence for each set of duplicated entries. The default value of keep isfirst.>>> idx.drop_duplicates(keep='first') Index(['lama', 'cow', 'beetle', 'hippo'], dtype='string')
The value
lastkeeps the last occurrence for each set of duplicated entries.>>> idx.drop_duplicates(keep='last') Index(['cow', 'beetle', 'lama', 'hippo'], dtype='string')
The value
Falsediscards all sets of duplicated entries.>>> idx.drop_duplicates(keep=False) Index(['cow', 'beetle', 'hippo'], dtype='string')
- Parameters:
keep ({‘first’, ‘last’,
False}, default ‘first’) – One of: ‘first’ : Drop duplicates except for the first occurrence. ‘last’ : Drop duplicates except for the last occurrence.False: Drop all duplicates.- Returns:
bigframes.pandas.Index