pandas.Index.insert — pandas 3.0.0.dev0+2104.ge637b4290d documentation (original) (raw)
Index.insert(loc, item)[source]#
Make new Index inserting new item at location.
Follows Python numpy.insert semantics for negative values.
Parameters:
locint
The integer location where the new item will be inserted.
itemobject
The new item to be inserted into the Index.
Returns:
Index
Returns a new Index object resulting from inserting the specified item at the specified location within the original Index.
See also
Append a collection of Indexes together.
Examples
idx = pd.Index(["a", "b", "c"]) idx.insert(1, "x") Index(['a', 'x', 'b', 'c'], dtype='object')