MCPcopy Index your code
hub / github.com/pydata/xarray / capitalize

Method capitalize

xarray/core/accessor_str.py:671–696  ·  view source on GitHub ↗

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" ... )

(self)

Source from the content-addressed store, hash-verified

669 )
670
671 def capitalize(self) -> T_DataArray:
672 """
673 Convert strings in the array to be capitalized.
674
675 Returns
676 -------
677 capitalized : same type as values
678
679 Examples
680 --------
681 >>> da = xr.DataArray(
682 ... ["temperature", "PRESSURE", "PreCipiTation", "daily rainfall"], dims="x"
683 ... )
684 >>> da
685 <xarray.DataArray (x: 4)> Size: 224B
686 array(['temperature', 'PRESSURE', 'PreCipiTation', 'daily rainfall'],
687 dtype='<U14')
688 Dimensions without coordinates: x
689 >>> capitalized = da.str.capitalize()
690 >>> capitalized
691 <xarray.DataArray (x: 4)> Size: 224B
692 array(['Temperature', 'Pressure', 'Precipitation', 'Daily rainfall'],
693 dtype='<U14')
694 Dimensions without coordinates: x
695 """
696 return self._apply(func=lambda x: x.capitalize())
697
698 def lower(self) -> T_DataArray:
699 """

Callers 3

test_case_bytesFunction · 0.80
test_case_strFunction · 0.80
test_empty_str_methodsFunction · 0.80

Calls 1

_applyMethod · 0.95

Tested by 3

test_case_bytesFunction · 0.64
test_case_strFunction · 0.64
test_empty_str_methodsFunction · 0.64