Skip to content

CLN: simplify+annotate _shallow_copy #32244

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 4 commits into from
Feb 26, 2020

Conversation

jbrockmendel
Copy link
Member

IntervalIndex is still an outlier, will be handled separately

@jbrockmendel jbrockmendel added Clean Constructors Series/DataFrame/Index/pd.array Constructors labels Feb 25, 2020
Copy link
Member

@simonjayhawkins simonjayhawkins left a comment

Choose a reason for hiding this comment

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

@jbrockmendel lgtm

a few inconsistencies between the methods. such as name = self.name if name is no_default else name vs name = name if name is not lib.no_default else self.name and name: Label = no_default vs name: Label = lib.no_default but not blocker.

return self._simple_new(self._range, name=name)
else:
kwargs.setdefault("name", self.name)
return self._int64index._shallow_copy(values, **kwargs)
return Int64Index._simple_new(values, name=name)
Copy link
Member

Choose a reason for hiding this comment

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

why is self._int64index replaced with Int64Index? does this affect subclassing?

Copy link
Member Author

Choose a reason for hiding this comment

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

Using Int64Index is more direct, avoids constructing self._int64index

Shouldn't affect subclasses, which isn't really supported anyway.

@simonjayhawkins simonjayhawkins added this to the 1.1 milestone Feb 25, 2020
@jbrockmendel
Copy link
Member Author

a few inconsistencies between the methods

Yah, that's just a matter of which modules already have lib imported.

@jreback jreback merged commit 89ed095 into pandas-dev:master Feb 26, 2020
@jreback
Copy link
Contributor

jreback commented Feb 26, 2020

thanks

@jbrockmendel jbrockmendel deleted the shallow-kwargs branch February 26, 2020 02:17
roberthdevries pushed a commit to roberthdevries/pandas that referenced this pull request Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Constructors Series/DataFrame/Index/pd.array Constructors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants