how to check for duplicates in a column in python 1

how to check for duplicates in a column in python

boolean = df['Student'].duplicated().any() # True

Here is what the above code is Doing:
1. df[‘Student’].duplicated() returns a Series of booleans (True if an element is a duplicate and False if not)
2. .any() returns True if any element in the Series is True

Similar Posts