xarray.core.accessor_str.StringAccessor.title

xarray.core.accessor_str.StringAccessor.title#

StringAccessor.title()[source]#

Convert strings in the array to titlecase.

Returns

titled (same type as values)

Examples

>>> da = xr.DataArray(["temperature", "PRESSURE", "HuMiDiTy"], dims="x")
>>> da
<xarray.DataArray (x: 3)> Size: 132B
array(['temperature', 'PRESSURE', 'HuMiDiTy'], dtype='<U11')
Dimensions without coordinates: x
>>> titled = da.str.title()
>>> titled
<xarray.DataArray (x: 3)> Size: 132B
array(['Temperature', 'Pressure', 'Humidity'], dtype='<U11')
Dimensions without coordinates: x