🍾 Xarray is now 10 years old! 🎉

xarray.DataArray.str.slice

xarray.DataArray.str.slice#

DataArray.str.slice(start=None, stop=None, step=None)[source]#

Slice substrings from each string in the array.

If start, stop, or ‘step` is array-like, they are broadcast against the array and applied elementwise.

Parameters:
  • start (int or array-like of int, optional) – Start position for slice operation. If array-like, it is broadcast.

  • stop (int or array-like of int, optional) – Stop position for slice operation. If array-like, it is broadcast.

  • step (int or array-like of int, optional) – Step size for slice operation. If array-like, it is broadcast.

Returns:

sliced strings (same type as values)