char.
compare_chararrays
Performs element-wise comparison of two string arrays using the comparison operator specified by cmp_op.
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 Boolean with the same shape as a and b.
If cmp_op is not valid.
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])