Skip to content
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

DEPR: deprecate dtype param in Index.copy #35853

Merged
merged 2 commits into from Aug 24, 2020

Conversation

topper-123
Copy link
Contributor

Deprecate dtype param in Index.copy and child methods. If users want to change dtype, they should use Index.astype.

@@ -1030,7 +1030,6 @@ def _shallow_copy(
name=lib.no_default,
levels=None,
codes=None,
dtype=None,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Other index types don't have dtype param in their _shallow_copy signature. Instead do dtype changing inside MultiIndex.copy.

@@ -820,6 +823,12 @@ def copy(self, name=None, deep=False, dtype=None, names=None):
new_index = self._shallow_copy(name=name)

if dtype:
warnings.warn(
"parameter dtype is deprecated and will be removed in a future version."
" Use the astype method instead.",
Copy link
Member

Choose a reason for hiding this comment

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

looks like linter wants the whitespace in the previous line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, fixed.

@topper-123 topper-123 force-pushed the deprecate_dtype_in_Index.copy branch from d5be44c to a828666 Compare August 22, 2020 17:02
@gfyoung gfyoung added Deprecate Functionality to remove in pandas Indexing Related to indexing on series/frames, not to indexes themselves labels Aug 23, 2020
@jreback jreback added this to the 1.2 milestone Aug 24, 2020
@jreback jreback merged commit 03fc7f9 into pandas-dev:master Aug 24, 2020
@jreback
Copy link
Contributor

jreback commented Aug 24, 2020

thanks @topper-123

@topper-123 topper-123 added Index Related to the Index class or subclasses and removed Indexing Related to indexing on series/frames, not to indexes themselves labels Aug 25, 2020
@topper-123 topper-123 deleted the deprecate_dtype_in_Index.copy branch August 27, 2020 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deprecate Functionality to remove in pandas Index Related to the Index class or subclasses
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants