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

Method casefold

xarray/core/accessor_str.py:791–830  ·  view source on GitHub ↗

Convert strings in the array to be casefolded. Casefolding is similar to converting to lowercase, but removes all case distinctions. This is important in some languages that have more complicated cases and case conversions. For example, the 'ß' chara

(self)

Source from the content-addressed store, hash-verified

789 return self._apply(func=lambda x: x.upper())
790
791 def casefold(self) -> T_DataArray:
792 """
793 Convert strings in the array to be casefolded.
794
795 Casefolding is similar to converting to lowercase,
796 but removes all case distinctions.
797 This is important in some languages that have more complicated
798 cases and case conversions. For example,
799 the 'ß' character in German is case-folded to 'ss', whereas it is lowercased
800 to 'ß'.
801
802 Returns
803 -------
804 casefolded : same type as values
805
806 Examples
807 --------
808 >>> da = xr.DataArray(["TEMPERATURE", "HuMiDiTy"], dims="x")
809 >>> da
810 <xarray.DataArray (x: 2)> Size: 88B
811 array(['TEMPERATURE', 'HuMiDiTy'], dtype='<U11')
812 Dimensions without coordinates: x
813 >>> casefolded = da.str.casefold()
814 >>> casefolded
815 <xarray.DataArray (x: 2)> Size: 88B
816 array(['temperature', 'humidity'], dtype='<U11')
817 Dimensions without coordinates: x
818
819 >>> da = xr.DataArray(["ß", "İ"], dims="x")
820 >>> da
821 <xarray.DataArray (x: 2)> Size: 8B
822 array(['ß', 'İ'], dtype='<U1')
823 Dimensions without coordinates: x
824 >>> casefolded = da.str.casefold()
825 >>> casefolded
826 <xarray.DataArray (x: 2)> Size: 16B
827 array(['ss', 'i̇'], dtype='<U2')
828 Dimensions without coordinates: x
829 """
830 return self._apply(func=lambda x: x.casefold())
831
832 def normalize(
833 self,

Callers 2

containsMethod · 0.95
test_case_strFunction · 0.80

Calls 1

_applyMethod · 0.95

Tested by 1

test_case_strFunction · 0.64