9951 explained code solutions for 126 technologies


python-pandasHow to drop duplicates from dataframe


import pandas as pd

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

df = df.drop_duplicates()ctrl + c
import pandas as pd

load Pandas module

pd.DataFrame

creates Pandas DataFrame object

.drop_duplicates(

drops given dataframe duplicates (by default, find duplicates based on all columns values)