count how many duplicates python pandas

df.duplicated(subset='one', keep='first').sum()

Here is what the above code is Doing:
1. We’re creating a DataFrame with three columns, one of which is a list of integers.
2. We’re creating a subset of the DataFrame that contains only the column ‘one’.
3. We’re using the duplicated() method to check for duplicates in the column ‘one’.
4. We’re using the keep=’first’ argument to keep only the first occurrence of each duplicate row.
5. We’re counting the number of duplicates in the column ‘one’.