Answers for "pandas remove repeated index"

0

pandas remove repeated index

df[~df.index.duplicated()]
Posted by: Guest on August-17-2020
0

pandas remove repeated index

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')
Posted by: Guest on August-17-2020

Python Answers by Framework

Browse Popular Code Answers by Language