xarray.DataArray.str.capitalize

xarray.DataArray.str.capitalize#

DataArray.str.capitalize()[source]#

Convert strings in the array to be capitalized.

Returns

capitalized (same type as values)

Examples

>>> da = xr.DataArray(
...     ["temperature", "PRESSURE", "PreCipiTation", "daily rainfall"], dims="x"
... )
>>> da
<xarray.DataArray (x: 4)> Size: 224B
array(['temperature', 'PRESSURE', 'PreCipiTation', 'daily rainfall'],
      dtype='<U14')
Dimensions without coordinates: x
>>> capitalized = da.str.capitalize()
>>> capitalized
<xarray.DataArray (x: 4)> Size: 224B
array(['Temperature', 'Pressure', 'Precipitation', 'Daily rainfall'],
      dtype='<U14')
Dimensions without coordinates: x