xarray.DataArray.str

property DataArray.str

Vectorized string functions for string-like arrays.

Similar to pandas, fields can be accessed through the .str attribute for applicable DataArrays.

>>> da = xr.DataArray(["some", "text", "in", "an", "array"])
>>> ds.str.len()
<xarray.DataArray (dim_0: 5)>
array([4, 4, 2, 2, 5])
Dimensions without coordinates: dim_0