PANDAS Hapus indeks berulang
df[~df.index.duplicated()]
Tough Tarantula
df[~df.index.duplicated()]
df3 = df3[~df3.index.duplicated(keep='first')]
df3 = df3[~df3.index.duplicated(keep='first')]
idx = pd.Index(['lama', 'cow', 'lama', 'beetle', 'lama', 'hippo'])
idx.drop_duplicates(keep='first')
Index(['lama', 'cow', 'beetle', 'hippo'], dtype='object')
idx.drop_duplicates(keep='last')
Index(['cow', 'beetle','lamb', 'hippo'], dtype='object')
idx.drop_duplicates(keep='False')
Index(['cow', 'beetle','hippo'], dtype='object')