Skip to content

REF: Simplify Index.copy #35592

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 10 commits into from
Aug 10, 2020
Merged

Conversation

topper-123
Copy link
Contributor

@topper-123 topper-123 commented Aug 6, 2020

Avoid the use of the Index.set_names in Index.copy, which is a slightly awkward method to use here (it calls _shallow_copy + is longwinded).

This is archieved by tightening up the checks in _validate_names.

@jreback jreback added Constructors Series/DataFrame/Index/pd.array Constructors Index Related to the Index class or subclasses labels Aug 6, 2020
@topper-123 topper-123 added this to the 1.2 milestone Aug 6, 2020
@topper-123
Copy link
Contributor Author

I`ve added tests.

@jreback
Copy link
Contributor

jreback commented Aug 7, 2020

lgtm ping on green.

@pep8speaks
Copy link

pep8speaks commented Aug 7, 2020

Hello @topper-123! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2020-08-08 15:43:16 UTC

@@ -1732,6 +1732,32 @@ def _validate_date_like_dtype(dtype) -> None:
)


def validate_all_hashable(*args, error_name=None) -> None:
Copy link
Member

Choose a reason for hiding this comment

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

can you type error_name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok.

@topper-123
Copy link
Contributor Author

Updated.

@jreback jreback merged commit 2560173 into pandas-dev:master Aug 10, 2020
@jreback
Copy link
Contributor

jreback commented Aug 10, 2020

thanks @topper-123

@topper-123 topper-123 deleted the ref_validate_names branch August 10, 2020 17:52
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.

4 participants