xarray.core.accessor_str.StringAccessor.isdigit

xarray.core.accessor_str.StringAccessor.isdigit#

StringAccessor.isdigit()[source]#

Check whether all characters in each string are digits.

Returns:

isdigit (array of bool) – Array of boolean values with the same shape as the original array.

Examples

>>> da = xr.DataArray(["123", "1.2", "0", "CO2", "NaCl"], dims="x")
>>> da
<xarray.DataArray (x: 5)> Size: 80B
array(['123', '1.2', '0', 'CO2', 'NaCl'], dtype='<U4')
Dimensions without coordinates: x
>>> isdigit = da.str.isdigit()
>>> isdigit
<xarray.DataArray (x: 5)> Size: 5B
array([ True, False,  True, False, False])
Dimensions without coordinates: x