9951 explained code solutions for 126 technologies


python-pandasHow to find duplicates in dataframe


import pandas as pd

df = pd.DataFrame({
  'Phone': ['ip5', 'ip6', 'ip8', 'sms', 'ip5'],
  'Price': [204,   304,   404,   405,   204  ]
})

df = df[df.duplicated()]ctrl + c
import pandas as pd

load Pandas module

pd.DataFrame

creates Pandas DataFrame object

.duplicated(

find duplicated rows and return boolean array (which can be used to filter dataframe)

df[

filter dataframe based on given expression