ENH: Add paramenter index
to drop_duplicates
to drop duplicate indices
#58648
Labels
index
to drop_duplicates
to drop duplicate indices
#58648
Feature Type
Adding new functionality to pandas
Changing existing functionality in pandas
Removing existing functionality in pandas
Problem Description
There currently is no elegant pattern to drop duplicate indices.
I think what people usually do is
df[~df.index.duplicated(keep='first')]
Feature Description
Add a new parameter to
drop_duplicates
to specify dropping duplicate indices.An option could be a
index=True
to do this, similar to when merging on an index.Alternative Solutions
Allow the
subset
parameter ofdrop_duplicates
to accept the name of the index.Additional Context
No response
The text was updated successfully, but these errors were encountered: