Skip to content

API: allow multiple indices in Index.insert #7384

Closed
@sinhrks

Description

@sinhrks

Derived from #7299. numpy.insert can accept multiple elements / indices as of v1.8.
http://docs.scipy.org/doc/numpy/reference/generated/numpy.insert.html

Allow Index to accept multiple elements / indices. Currently, it raises IndexError.

import pandas as pd
idx1 = pd.Index([1, 2, 3, 4, 5])
idx1.insert([1, 2], 0)
# IndexError: invalid slice

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementIndexRelated to the Index class or subclasses

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions