-
-
Couldn't load subscription status.
- Fork 19.2k
Closed
Labels
BugIndexingRelated to indexing on series/frames, not to indexes themselvesRelated to indexing on series/frames, not to indexes themselves
Milestone
Description
It is my understanding that the copy parameter of RangeIndex is present virtually only for API compatibility with other indices: however the behaviour for copy=False differs from other indices in what follows:
In [2]: i = pd.Int64Index(range(10))
In [3]: i.name = 'original'
In [4]: j = pd.Int64Index(i)
In [5]: j.name
In [6]: j.name = 'copy'
In [7]: i.name
Out[7]: 'original'
In [8]: i = pd.RangeIndex(10)
In [9]: i.name = 'original'
In [10]: j = pd.RangeIndex(i)
In [11]: j.name
Out[11]: 'original'
In [12]: j.name = 'copy'
In [13]: i.name
Out[13]: 'copy'
In other words, since RangeIndex doesn't have any data to copy, the value of the copy parameter should be irrelevant. For homogeneity with other indices, we should always act as if copy=True. The docs should also be changed to state that copy parameter has no effect and is present only for API compatibility. I'll push a PR if you agree.
Metadata
Metadata
Assignees
Labels
BugIndexingRelated to indexing on series/frames, not to indexes themselvesRelated to indexing on series/frames, not to indexes themselves