From 561a9aae424b32cb85161b5f573997b03f3fe947 Mon Sep 17 00:00:00 2001 From: lzha97 Date: Mon, 26 Sep 2022 06:56:23 -0400 Subject: 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) --- numpy/core/defchararray.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'numpy/core/defchararray.py') 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') -- cgit v1.2.1