![]() ![]() ![]() df.shapeįrom the output above there are 310 rows with 79 duplicates which are extracted by using the. Now to extract the duplicates out (remember the first occurrence is not a duplicate rather the subsequence occurrence are duplicates and will be outputted by this method) we need to pass this method to a data frame. Name: Employee_Name, dtype: object Example df.duplicated().head(3) Output 0 False Confused? Let me try to explain one more time with an example, suppose there are 3 apples in a basket what this method does is mark the first apple as non-duplicate and the rest of the two apples as duplicates. This method does not mark a row as duplicate if it exists more than once, rather it marks each subsequent row after the first row as duplicate. The way duplicated() works by default is by keep parameter, This parameter is going to mark the very first occurrence of each value as a non-duplicate.
0 Comments
Leave a Reply. |