Skip to content

Index constructor should always make a shallow copy, never returning the same object #10033

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

Closed
shoyer opened this issue Apr 30, 2015 · 1 comment
Labels
API Design Index Related to the Index class or subclasses

Comments

@shoyer
Copy link
Member

shoyer commented Apr 30, 2015

This is currently not the case (e.g., for TimedeltaIndex)

as discussed in #10026.

@jreback jreback added API Design Indexing Related to indexing on series/frames, not to indexes themselves labels Aug 5, 2015
@toobaz toobaz added Index Related to the Index class or subclasses and removed Indexing Related to indexing on series/frames, not to indexes themselves labels Jun 28, 2019
@toobaz
Copy link
Member

toobaz commented Jun 28, 2019

I think this was fixed, at least for TimedeltaIndex.

In [2]: tdi = pd.TimedeltaIndex(['2d', '3d'])                                                                                                                 

In [3]: id(tdi)                                                                                                                                               
Out[3]: 140386936136200

In [4]: id(pd.TimedeltaIndex(tdi))                                                                                                                            
Out[4]: 140386936137712

In [5]: id(tdi.copy())                                                                                                                                        
Out[5]: 140386936309688

(Please reopen if I misunderstood...)

@toobaz toobaz closed this as completed Jun 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Index Related to the Index class or subclasses
Projects
None yet
Development

No branches or pull requests

3 participants