🍾 Xarray is now 10 years old! 🎉

xarray.DataArray.str.isdigit

xarray.DataArray.str.isdigit#

DataArray.str.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