pandas.api.extensions.ExtensionArray.delete#
- ExtensionArray.delete(loc)[source]#
Return a new array with the elements at the given positions removed.
The original array is not modified. The default implementation selects the remaining positions with
ExtensionArray.take().- Parameters:
- locint, slice, list of int or ndarray
Positions of the elements to remove, in any form accepted by
numpy.delete().
- Returns:
- ExtensionArray
A new array of the same dtype without the elements at
loc.
See also
ExtensionArray.insertInsert an item at the given position.
ExtensionArray.takeTake elements from an array.
Examples
>>> arr = pd.array([1, 2, 3, 4]) >>> arr.delete([0, 2]) <IntegerArray> [2, 4] Length: 2, dtype: Int64 >>> arr.delete(slice(1, 3)) <IntegerArray> [1, 4] Length: 2, dtype: Int64