import pandas as pd
data = pd.DataFrame({'k1':['one']*3 + ['two']*4,'k2':[1,1,2,3,3,4,4]})
data.duplicated()
data.drop_duplicates()
#filter duplicates only based on the 'k1' column
data.drop_duplicates(['k1'])
#filter duplicates only based on the 'k2' column
data.drop_duplicates(['k2'])

Discover more from Tips and Hints for Aerospace Engineers

Subscribe now to keep reading and get access to the full archive.

Continue reading