🍾 Xarray is now 10 years old! 🎉

xarray.DataArray.str.isnumeric

xarray.DataArray.str.isnumeric#

DataArray.str.isnumeric()[source]#

Check whether all characters in each string are numeric.

Returns:

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

Examples

>>> da = xr.DataArray(["123", "2.3", "H2O", "NaCl-", "Mn"], dims="x")
>>> da
<xarray.DataArray (x: 5)> Size: 100B
array(['123', '2.3', 'H2O', 'NaCl-', 'Mn'], dtype='<U5')
Dimensions without coordinates: x
>>> isnumeric = da.str.isnumeric()
>>> isnumeric
<xarray.DataArray (x: 5)> Size: 5B
array([ True, False, False, False, False])
Dimensions without coordinates: x