pandas / 1 / reference / api / pandas.api.extensions.extensionarray.insert.html

pandas.api.extensions.ExtensionArray.insert

ExtensionArray.insert(loc, item)[source]

Insert an item at the given position.

Parameters
loc:int
item:scalar-like
Returns
same type as self

Notes

This method should be both type and dtype-preserving. If the item cannot be held in an array of this type/dtype, either ValueError or TypeError should be raised.

The default implementation relies on _from_sequence to raise on invalid items.

© 2008–2022, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/1.5.0/reference/api/pandas.api.extensions.ExtensionArray.insert.html