xarray.core.accessor_str.StringAccessor.slice_replace¶
-
StringAccessor.
slice_replace
(start=None, stop=None, repl='')[source]¶ Replace a positional slice of a string with another value.
If start, stop, or ‘repl` is array-like, they are broadcast against the array and applied elementwise.
- Parameters
start (
int
or array-like ofint
, optional) – Left index position to use for the slice. If not specified (None), the slice is unbounded on the left, i.e. slice from the start of the string. If array-like, it is broadcast.stop (
int
or array-like ofint
, optional) – Right index position to use for the slice. If not specified (None), the slice is unbounded on the right, i.e. slice until the end of the string. If array-like, it is broadcast.repl (
str
or array-like ofstr
, optional) – String for replacement. If not specified, the sliced region is replaced with an empty string. If array-like, it is broadcast.
- Returns
replaced (
same type as values
)