summaryrefslogtreecommitdiff
path: root/numpy/core/defchararray.py
diff options
context:
space:
mode:
authorlzha97 <lillianzha@gmail.com>2022-09-26 06:56:23 -0400
committerGitHub <noreply@github.com>2022-09-26 12:56:23 +0200
commit561a9aae424b32cb85161b5f573997b03f3fe947 (patch)
tree6db6a37fe61de57f4ddc6a991a95aa0f304b71a2 /numpy/core/defchararray.py
parent664a9f5cad40e958c73d2bc78f9bcd5bd5f818e6 (diff)
downloadnumpy-561a9aae424b32cb85161b5f573997b03f3fe947.tar.gz
DOC: examples for `np.char.isdecimal` and `np.char.isnumeric` (#22300)
* DOC: examples for np.char.isdecimal and np.char.isnumeric (See #22267) * DOC: fix formatting np.char function example (See #22267) * DOC: remove non-array input examples (See #22267)
Diffstat (limited to 'numpy/core/defchararray.py')
-rw-r--r--numpy/core/defchararray.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/numpy/core/defchararray.py b/numpy/core/defchararray.py
index 2ccc30dd7..0a4b091a8 100644
--- a/numpy/core/defchararray.py
+++ b/numpy/core/defchararray.py
@@ -1848,6 +1848,11 @@ def isnumeric(a):
--------
unicode.isnumeric
+ Examples
+ --------
+ >>> np.char.isnumeric(['123', '123abc', '9.0', '1/4', 'VIII'])
+ array([ True, False, False, False, False])
+
"""
if _use_unicode(a) != unicode_:
raise TypeError("isnumeric is only available for Unicode strings and arrays")
@@ -1880,7 +1885,12 @@ def isdecimal(a):
--------
unicode.isdecimal
- """
+ Examples
+ --------
+ >>> np.char.isdecimal(['12345', '4.99', '123ABC', ''])
+ array([ True, False, False, False])
+
+ """
if _use_unicode(a) != unicode_:
raise TypeError("isnumeric is only available for Unicode strings and arrays")
return _vec_string(a, bool_, 'isdecimal')