import pandas as pd
data = {
"name": ["John", "Mary", "John", "Sally", "Mary"],
"age": [40, 30, 40, 50, 30],
"city": ["Bergen", "Oslo", "Stavanger", "Oslo", "Oslo"]
}
df = pd.DataFrame(data)
s = df.duplicated()
print(s)
#Column 4 returns True because:
#It is identical to column 1.
0 False 1 False 2 False 3 False 4 True dtype: bool