duplicated(self, keep='first') -> 'Series'
Duplicated values are indicated as True
values in the resulting Series. Either all duplicates, all except the first or all except the last occurrence of duplicates can be indicated.
Method to handle dropping duplicates:
Series indicating whether each value has occurred in the preceding values.
Indicate duplicate Series values.
DataFrame.duplicated
Equivalent method on pandas.DataFrame.
Index.duplicated
Equivalent method on pandas.Index.
Series.drop_duplicates
Remove duplicate values from Series.
By default, for each set of duplicated values, the first occurrence is set on False and all others on True:
This example is valid syntax, but we were not able to check execution>>> animals = pd.Series(['lama', 'cow', 'lama', 'beetle', 'lama'])
... animals.duplicated() 0 False 1 False 2 True 3 False 4 True dtype: bool
which is equivalent to
This example is valid syntax, but we were not able to check execution>>> animals.duplicated(keep='first') 0 False 1 False 2 True 3 False 4 True dtype: bool
By using 'last', the last occurrence of each set of duplicated values is set on False and all others on True:
This example is valid syntax, but we were not able to check execution>>> animals.duplicated(keep='last') 0 True 1 False 2 True 3 False 4 False dtype: bool
By setting keep on False
, all duplicates are True:
>>> animals.duplicated(keep=False) 0 True 1 False 2 True 3 False 4 True dtype: boolSee :
The following pages refer to to this document either explicitly or contain code examples using this.
pandas.core.indexes.base.Index.duplicated
pandas.core.series.Series.drop_duplicates
pandas.core.indexes.multi.MultiIndex.duplicated
pandas.core.frame.DataFrame.duplicated
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them