bigframes.geopandas.GeoSeries.drop_duplicates#

GeoSeries.drop_duplicates(*, keep: str = 'first') Series#

Return Series with duplicate values removed.

Examples:

Generate a Series with duplicated entries.

>>> import bigframes.pandas as bpd
>>> s = bpd.Series(['llama', 'cow', 'llama', 'beetle', 'llama', 'hippo'],
...                name='animal')
>>> s
0     llama
1       cow
2     llama
3    beetle
4     llama
5     hippo
Name: animal, dtype: string

With the ‘keep’ parameter, the selection behaviour of duplicated values can be changed. The value ‘first’ keeps the first occurrence for each set of duplicated entries. The default value of keep is ‘first’.

>>> s.drop_duplicates()
0     llama
1       cow
3    beetle
5     hippo
Name: animal, dtype: string

The value ‘last’ for parameter ‘keep’ keeps the last occurrence for each set of duplicated entries.

>>> s.drop_duplicates(keep='last')
1       cow
3    beetle
4     llama
5     hippo
Name: animal, dtype: string

The value False for parameter ‘keep’ discards all sets of duplicated entries.

>>> s.drop_duplicates(keep=False)
1       cow
3    beetle
5     hippo
Name: animal, dtype: string
Parameters:

keep ({‘first’, ‘last’, False}, default ‘first’) –

Method to handle dropping duplicates:

’first’ : Drop duplicates except for the first occurrence. ‘last’ : Drop duplicates except for the last occurrence. False : Drop all duplicates.

Returns:

Series with duplicates dropped or None if inplace=True.

Return type:

bigframes.pandas.Series