diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2018-11-13 12:57:28 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-13 12:57:28 -0600 |
commit | 9a638517d4cce4c8b34971538d2cebce0a6feb49 (patch) | |
tree | 8b165858b048acddc09206686e6b0f7d59ab5595 | |
parent | 8d1239363a6eef9bf2000ad75f24bb93e45f33bf (diff) | |
parent | d6538309351f3138ed1d0c46eb72bc5f68134373 (diff) | |
download | numpy-9a638517d4cce4c8b34971538d2cebce0a6feb49.tar.gz |
Merge pull request #12338 from ryzheboka/docs-for-compare_chararrays
DOC: add a docstring for the function 'compare_chararrays' (See #10106)
-rw-r--r-- | numpy/core/_add_newdocs.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/numpy/core/_add_newdocs.py b/numpy/core/_add_newdocs.py index f67964d84..12ef9d65a 100644 --- a/numpy/core/_add_newdocs.py +++ b/numpy/core/_add_newdocs.py @@ -1072,6 +1072,43 @@ add_newdoc('numpy.core.multiarray', 'fromstring', """) +add_newdoc('numpy.core.multiarray', 'compare_chararrays', + """ + compare_chararrays(a, b, cmp_op, rstrip) + + Performs element-wise comparison of two string arrays using the + comparison operator specified by `cmp_op`. + + Parameters + ---------- + a, b : array_like + Arrays to be compared. + cmp_op : {"<", "<=", "==", ">=", ">", "!="} + Type of comparison. + rstrip : Boolean + If True, the spaces at the end of Strings are removed before the comparison. + + Returns + ------- + out : ndarray + The output array of type Boolean with the same shape as a and b. + + Raises + ------ + ValueError + If `cmp_op` is not valid. + TypeError + If at least one of `a` or `b` is a non-string array + + Examples + -------- + >>> a = np.array(["a", "b", "cde"]) + >>> b = np.array(["a", "a", "dec"]) + >>> np.compare_chararrays(a, b, ">", True) + array([False, True, False]) + + """) + add_newdoc('numpy.core.multiarray', 'fromiter', """ fromiter(iterable, dtype, count=-1) |