Skip to content

Index._shallow_copy does not handle data types #9170

Closed
@behzadnouri

Description

@behzadnouri

integer index with float data types:

>>> i
Int64Index([1, 2], dtype='int64')
>>> i._shallow_copy(i.values.astype('f8'))
Int64Index([1.0, 2.0], dtype='float64')

another issue: an index which is not equal to its copy:

>>> i
Float64Index([1.0, 2.0], dtype='float64')
>>> j = i._shallow_copy(i.values.astype('O'))
>>> j
Float64Index([1.0, 2.0], dtype='object')
>>> j.equals(i)
False
>>> j.equals(j.copy())
False

Metadata

Metadata

Assignees

No one assigned

    Labels

    InternalsRelated to non-user accessible pandas implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions