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

Function test_isnumeric

xarray/tests/test_accessor_str.py:1743–1759  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1741
1742
1743def test_isnumeric() -> None:
1744 # 0x00bc: ¼ VULGAR FRACTION ONE QUARTER
1745 # 0x2605: ★ not number
1746 # 0x1378: ፸ ETHIOPIC NUMBER SEVENTY
1747 # 0xFF13: 3 Em 3
1748 values = xr.DataArray(["A", "3", "¼", "★", "፸", "3", "four"])
1749 exp_numeric = xr.DataArray([False, True, True, False, True, True, False])
1750 exp_decimal = xr.DataArray([False, True, False, False, False, True, False])
1751
1752 res_numeric = values.str.isnumeric()
1753 res_decimal = values.str.isdecimal()
1754
1755 assert res_numeric.dtype == exp_numeric.dtype
1756 assert res_decimal.dtype == exp_decimal.dtype
1757
1758 assert_equal(res_numeric, exp_numeric)
1759 assert_equal(res_decimal, exp_decimal)
1760
1761
1762def test_len(dtype) -> None:

Callers

nothing calls this directly

Calls 3

assert_equalFunction · 0.90
isnumericMethod · 0.80
isdecimalMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…