MCPcopy Create free account
hub / github.com/numpy/numpy / isnumeric

Function isnumeric

numpy/core/defchararray.py:1848–1881  ·  view source on GitHub ↗

For each element, return True if there are only numeric characters in the element. Calls `str.isnumeric` element-wise. Numeric characters include digit characters, and all characters that have the Unicode numeric value property, e.g. ``U+2155, VULGAR FRACTION ONE FIFTH``.

(a)

Source from the content-addressed store, hash-verified

1846
1847@array_function_dispatch(_unary_op_dispatcher)
1848def isnumeric(a):
1849 """
1850 For each element, return True if there are only numeric
1851 characters in the element.
1852
1853 Calls `str.isnumeric` element-wise.
1854
1855 Numeric characters include digit characters, and all characters
1856 that have the Unicode numeric value property, e.g. ``U+2155,
1857 VULGAR FRACTION ONE FIFTH``.
1858
1859 Parameters
1860 ----------
1861 a : array_like, unicode
1862 Input array.
1863
1864 Returns
1865 -------
1866 out : ndarray, bool
1867 Array of booleans of same shape as `a`.
1868
1869 See Also
1870 --------
1871 str.isnumeric
1872
1873 Examples
1874 --------
1875 >>> np.char.isnumeric(['123', '123abc', '9.0', '1/4', 'VIII'])
1876 array([ True, False, False, False, False])
1877
1878 """
1879 if not _is_unicode(a):
1880 raise TypeError("isnumeric is only available for Unicode strings and arrays")
1881 return _vec_string(a, bool_, 'isnumeric')
1882
1883
1884@array_function_dispatch(_unary_op_dispatcher)

Callers 1

isnumericMethod · 0.85

Calls 2

_vec_stringFunction · 0.90
_is_unicodeFunction · 0.85

Tested by

no test coverage detected