databricks.koalas.Index.insert

Index.insert(loc: int, item) → databricks.koalas.indexes.base.Index[source]

Make new Index inserting new item at location.

Follows Python list.append semantics for negative values.

Parameters
locint
itemobject
Returns
new_indexIndex

Examples

>>> kidx = ks.Index([1, 2, 3, 4, 5])
>>> kidx.insert(3, 100)
Int64Index([1, 2, 3, 100, 4, 5], dtype='int64')

For negative values

>>> kidx = ks.Index([1, 2, 3, 4, 5])
>>> kidx.insert(-3, 100)
Int64Index([1, 2, 100, 3, 4, 5], dtype='int64')