diff options
author | Matti Picus <matti.picus@gmail.com> | 2020-08-11 08:37:00 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-11 08:37:00 +0300 |
commit | 7aced6e57253f6e10960ab33f05229a6f882b094 (patch) | |
tree | 4156669a08025747ac38114f8b1afc2ae08f6eb7 /numpy | |
parent | 00a45b4dca164105b50ba29e1735e96b573b639c (diff) | |
parent | 39ee806830bb5bd57fcdf767ee3a2f630f069e03 (diff) | |
download | numpy-7aced6e57253f6e10960ab33f05229a6f882b094.tar.gz |
Merge pull request #17036 from BvB93/char-doc
DOC: Clarify that `np.char` comparison functions always return ndarrays
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/defchararray.py | 24 | ||||
-rw-r--r-- | numpy/core/tests/test_defchararray.py | 6 |
2 files changed, 18 insertions, 12 deletions
diff --git a/numpy/core/defchararray.py b/numpy/core/defchararray.py index 1d447b86a..9d7b54a1a 100644 --- a/numpy/core/defchararray.py +++ b/numpy/core/defchararray.py @@ -114,8 +114,8 @@ def equal(x1, x2): Returns ------- - out : ndarray or bool - Output array of bools, or a single bool if x1 and x2 are scalars. + out : ndarray + Output array of bools. See Also -------- @@ -140,8 +140,8 @@ def not_equal(x1, x2): Returns ------- - out : ndarray or bool - Output array of bools, or a single bool if x1 and x2 are scalars. + out : ndarray + Output array of bools. See Also -------- @@ -167,8 +167,8 @@ def greater_equal(x1, x2): Returns ------- - out : ndarray or bool - Output array of bools, or a single bool if x1 and x2 are scalars. + out : ndarray + Output array of bools. See Also -------- @@ -193,8 +193,8 @@ def less_equal(x1, x2): Returns ------- - out : ndarray or bool - Output array of bools, or a single bool if x1 and x2 are scalars. + out : ndarray + Output array of bools. See Also -------- @@ -219,8 +219,8 @@ def greater(x1, x2): Returns ------- - out : ndarray or bool - Output array of bools, or a single bool if x1 and x2 are scalars. + out : ndarray + Output array of bools. See Also -------- @@ -245,8 +245,8 @@ def less(x1, x2): Returns ------- - out : ndarray or bool - Output array of bools, or a single bool if x1 and x2 are scalars. + out : ndarray + Output array of bools. See Also -------- diff --git a/numpy/core/tests/test_defchararray.py b/numpy/core/tests/test_defchararray.py index bbb94f7d3..59fc54722 100644 --- a/numpy/core/tests/test_defchararray.py +++ b/numpy/core/tests/test_defchararray.py @@ -179,6 +179,12 @@ class TestComparisons: def test_less(self): assert_array_equal((self.A < self.B), [[True, False], [False, False]]) + def test_type(self): + out1 = np.char.equal(self.A, self.B) + out2 = np.char.equal('a', 'a') + assert_(isinstance(out1, np.ndarray)) + assert_(isinstance(out2, np.ndarray)) + class TestComparisonsMixed1(TestComparisons): """Ticket #1276""" |