Skip to content

REF: shallow_copy->simple_new/rename #39444

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 3 commits into from
Jan 28, 2021

Conversation

jbrockmendel
Copy link
Member

No description provided.

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

can you completely remove _shallow_copy?

@jreback jreback added Constructors Series/DataFrame/Index/pd.array Constructors Index Related to the Index class or subclasses labels Jan 28, 2021
@jbrockmendel
Copy link
Member Author

can you completely remove _shallow_copy?

Short answer: i think so.

Use cases that are just self._shallow_copy() could be replaced with self.view() (or implement a self._view fastpath) and self._shallow_copy(name=foo) that could use self.rename (or implement a self._rename fastpath).

There's one usage that can't be removed until #38140 (or we implement an equivalent shim in Categorical._get_unique_index)

That leaves 7 usages in core.indexes which i think can use simple_new directly (though MultiIndex may throw a wrench in that)

@jreback jreback added this to the 1.3 milestone Jan 28, 2021
@jreback jreback merged commit 2be78cc into pandas-dev:master Jan 28, 2021
@jbrockmendel
Copy link
Member Author

Want to move forward with the rest of the shallow_copy usages?

@jbrockmendel jbrockmendel deleted the ref-shallow-less branch January 28, 2021 20:14
@jreback
Copy link
Contributor

jreback commented Jan 28, 2021

yep i think that would be good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Constructors Series/DataFrame/Index/pd.array Constructors Index Related to the Index class or subclasses
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants