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

Method isdecimal

xarray/core/accessor_str.py:902–924  ·  view source on GitHub ↗

Check whether all characters in each string are decimal. Returns ------- isdecimal : array of bool Array of boolean values with the same shape as the original array. Examples -------- >>> da = xr.DataArray(["2.3", "123", "0"], di

(self)

Source from the content-addressed store, hash-verified

900 return self._apply(func=lambda x: x.isalpha(), dtype=bool)
901
902 def isdecimal(self) -> T_DataArray:
903 """
904 Check whether all characters in each string are decimal.
905
906 Returns
907 -------
908 isdecimal : array of bool
909 Array of boolean values with the same shape as the original array.
910
911 Examples
912 --------
913 >>> da = xr.DataArray(["2.3", "123", "0"], dims="x")
914 >>> da
915 <xarray.DataArray (x: 3)> Size: 36B
916 array(['2.3', '123', '0'], dtype='<U3')
917 Dimensions without coordinates: x
918 >>> isdecimal = da.str.isdecimal()
919 >>> isdecimal
920 <xarray.DataArray (x: 3)> Size: 3B
921 array([False, True, True])
922 Dimensions without coordinates: x
923 """
924 return self._apply(func=lambda x: x.isdecimal(), dtype=bool)
925
926 def isdigit(self) -> T_DataArray:
927 """

Callers 2

test_empty_str_methodsFunction · 0.80
test_isnumericFunction · 0.80

Calls 1

_applyMethod · 0.95

Tested by 2

test_empty_str_methodsFunction · 0.64
test_isnumericFunction · 0.64