Performs element-wise comparison of two string arrays using the comparison operator specified by cmp.
Arrays to be compared.
Type of comparison.
If True, the spaces at the end of strings are removed before the comparison.
The output array of type numpy.bool with the same shape as a1 and a2.
If cmp is not valid.
If at least one of a1 or a2 is a non-string array
>>> import numpy as np >>> a = np.array(["a", "b", "cde"]) >>> b = np.array(["a", "a", "dec"]) >>> np.char.compare_chararrays(a, b, ">", True) array([False, True, False])
© 2005–2024 NumPy Developers
Licensed under the 3-clause BSD License.
https://numpy.org/doc/2.4/reference/generated/numpy.char.compare_chararrays.html