8000 ENH: Add ignore_index for df.drop_duplicates by charlesdong1991 · Pull Request #30405 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

ENH: Add ignore_index for df.drop_duplicates #30405

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Dec 27, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
keep consistency
  • Loading branch information
charlesdong1991 committed Dec 23, 2019
commit 1b6dc51a06102d8f88cf11fac6f0268d971556a6
2 changes: 1 addition & 1 deletion pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -4626,7 +4626,7 @@ def drop_duplicates(
new_data = self._data.take(inds)

if ignore_index:
new_data.axes[1] = ibase.default_index(len(inds))
new_data = new_data.reset_index(drop=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use reset_index, simply use what you did in the other PR, default_index. .reset_index() causes another copy here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, changed!

self._update_inplace(new_data)
else:
result = self[-duplicated]
Expand Down
0