pandas.Index.insert
pandas 3.1.1 · Index objects · method
Add a value at a position. DataFrame inserts a column and rejects duplicate labels by default.
Call syntax
Index.insert(loc, item)Run the example
Edit the example and select Run Python to see the result.
Parameters
| Parameter | Requirement | Accepted values and behavior |
|---|---|---|
loc |
Required Positional or keyword |
int Supply a zero-based position where a label or item should be inserted or read. |
item |
Required Positional or keyword |
object |
Returns
Index